From: Vladimir Fekete Date: 2008-12-08T18:20:03+09:00 Subject: Re: A quetion about ruby string Hi, classical #{} works... e.g: a = "asd" puts "SAME" if "asd" =~ /#{a}/ Cheers, V. On Mon, Dec 08, 2008 at 06:04:49PM +0900, Zhao Yi wrote: > How can I change a string to regular expression? Take this method for an > example: > > def match(pattern) > ... > end > > This method accepts one parameter as a regular expression pattern, when > I invoke this method by > > match(/.../) > > it works fine. But if I invoke this method by > > param="/.../" > match(param) > > it doesn't work as expected. It seems that the string is different with > the regular expression. If the pattern stored in a string variable, how > can I use it? > > thanks. > -- > Posted via http://www.ruby-forum.com/. > >