From: Robert Klemme Date: 2009-08-21T19:50:02+09:00 Subject: Re: How to convert string "/regexp/i" to /regexp/i - ? 2009/8/21 Pascal J. Bourguignon : > Joao Silva writes: > >> Fleck Jean-Julien wrote: >>> 2009/8/21 Joao Silva : >>>> >>>> How i can convert this proper way? >>> >>> Try without the quotes >>> >>>>> Regexp.new(/regexp/i) >>> => /regexp/i >>> >>> Cheers, >> >> I cannot do this without quotes - i need get it from string. Only thing >> i have is "/regexp/i" string. > > string="/regexp/i" > Regexp.new(eval(string)) "Regexp.new" is superfluous: irb(main):002:0> eval("/regexp/i").class => Regexp irb(main):003:0> Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/