A
Alex Fenton
Possible RCR: would anyone else find this a useful addition to the core
class String
def to_rx
Regexp.new( Regexp.escape(self) )
end
end
as a more straightforward & readable alternative to interpolation:
/#{Regexp.escape(a_string)}/
I turned up a few references to this sort of thing in ruby code on the web.
alex
class String
def to_rx
Regexp.new( Regexp.escape(self) )
end
end
as a more straightforward & readable alternative to interpolation:
/#{Regexp.escape(a_string)}/
I turned up a few references to this sort of thing in ruby code on the web.
alex