From: nobu.nokada@... Date: 2002-05-16T08:14:52+09:00 Subject: Re: How to Convert Regex Back to String in Exact Match? Hi, At Thu, 16 May 2002 02:39:56 +0900, William Djaja Tjokroaminata wrote: > 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? Keeping original string. :) > 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. Strip backslashes followed by any letter. reg.source.sub(/\A\\A/, '').sub(/\\z\z/, '').gsub(/\\(.)/, '\1') -- Nobu Nakada