From: James Edward Gray II Date: 2007-07-05T01:43:24+09:00 Subject: Re: Using eval() to create a Regexp object from a string On Jul 4, 2007, at 10:51 AM, Ivan V. wrote: > Suppose some_function() returns the string '/home/test' I see you already have your answer, but another thing you may want to be aware of is Regexp.escape(): def some_function; '/home/test' end re = /#{Regexp.escape(some_function)}/ # => /\/home\/test/ re.source # => "/home/test" James Edward Gray II