Hi,

Some time ago, I posted the question on "How to Convert String to Regex to
Perform Exact Match".  The problem is to generate a regex "reg" from
string "str" such that these two are equivalent:

    someString == str

    someString =~ reg

and the answer is

    reg = Regexp.new('\A' + Regexp.escape(str) + '\z')

Now, given a regex "reg" that was created from a string "str" such as
above, is there any simple way to recover str back from reg?  I know that
in general it is impossible to convert a regex into a string.  However, in
the special case such as above (we know how reg was created from str), is
there an easy way to convert reg to str?

Basically, I need the inverse of the method escape.  I can remove '\A'
and '\z' without any problem, but I don't know how to deal with all the
replacements that have been done by the method escape.  Thanks.

Regards,

Bill