From: Tony Arcieri Date: 2011-12-26T12:22:15+09:00 Subject: Re: Scan - variable as pattern --000325556656b6060504b4f6457c Content-Type: text/plain; charset=ISO-8859-1 You can interpolate regular expressions just as you would strings: str.scan(/#{s}/) On Sun, Dec 25, 2011 at 6:52 PM, Sashi K. wrote: > I want to define a variable, like: > s='.' > > And then use that variable as an argument for scan > > str.scan(/s/) > > In the above I want the . substituted for s. > > Is there any way this can be done - pass a variable to scan? > > Thanks > > -- > Posted via http://www.ruby-forum.com/. > > -- Tony Arcieri --000325556656b6060504b4f6457c--