Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8013959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:47:10+00:00 2026-06-04T19:47:10+00:00

Suppose we have some text and a regular expression that matches it. Question: if

  • 0

Suppose we have some text and a regular expression that matches it. Question: if I apply the same expression to text backwards (starting from the last letter to the first one), will it still match?

regex —–> text

xereg –?–> txet

In practice that seems to work, the question is rather about what the theory says about the general case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:47:11+00:00Added an answer on June 4, 2026 at 7:47 pm

    Not if you use the Kleene star – if you reverse the regex, you will end up with an invalid regex or one that matches a different pattern:

    • ab* -> *ba (invalid syntax)
    • a*b -> b*a (the first one matches aaab but not abbb, while the second one matches bbba but not baaa)

    On the other hand, I’m quite sure that it would be possible to design an algorithm that, given a regex, produces a regex that matches the reverse strings. The following recursive algorithm should work (if r is a regex, rev(r) means the regex that matches the reversed strings):

    • If r is a single symbol x, then rev(r) = x.
    • If r is a union A|B, then rev(r) = rev(A)|rev(B).
    • If r is a concatenation AB, then rev(r) = rev(B)rev(A).
    • If r is a Kleene star A*, then rev(r) = rev(A)*.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have some text files (f1.txt, f2.txt, ...) that looks something like @article
Lets suppose that I have some pages some.web/articles/details/5 some.web/users/info/bob some.web/foo/bar/7 that can call a
I have some not understanding actions from gnu clisp Suppose, I have some code
Suppose I have a Collection of some kind that itself contains Collections; e.g., Dictionary(Of
Suppose you have a subsystem that does some kind of work. It could be
Suppose I have a class that processes some data: class SomeClass { public: void
Suppose I have a text file with some data I want to retrieve lost
I have UI which displaying status of long-running operations (downloading some text files from
Suppose I have some text which is displayed over an image or some other
I have some text in a string, I need to check whether that particular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.