From: William Djaja Tjokroaminata Date: 2002-05-18T00:45:12+09:00 Subject: Re: How to Convert Regex Back to String in Exact Match? Thanks for all the replies. I conclude that the solution of re = Regexp.new('\A' + Regexp.escape(str) + '\z') # (1) is str = re.source.sub(/\A\\A/,'').sub(/\\z\z/,'').gsub(/\\(.)/,'\1') # (2) However, as already pointed out by several people, I also infer that probably it is a very good idea to store the original string, because when I just invoke (2), I actually have little clue whether the regex was originally created using (1), and when it is actually not, I have not much control on what (2) will give me. At least, I learn a very useful Ruby (or simply Regexp) "trick". Thanks, everyone. Regards, Bill