On Thu, 16 May 2002, William Djaja Tjokroaminata wrote:

> the special case such as above (we know how reg was created from str), is
> there an easy way to convert reg to str?

Untested && unsporting && wasteful code follows, taking lead from Nobu's
suggestion to save the string -- let the class do it for you...

class Regexp
  alias old_escape escape
  def Regexp.escape(string)
    escaped = old_escape(string)
    @@unescape = {} unless defined?(@@unescape)
    @@unescape[escaped]=string
    return escaped
  end
  def Regexp.unescape(regexp)
    @@unescape[regexp] || raise
  end
end

;)

 -- Nikodemus