From: Robert Klemme Date: 2011-12-27T03:20:33+09:00 Subject: Re: Scan - variable as pattern On Mon, Dec 26, 2011 at 4:23 AM, Chris Hulan wrote: > The docs for rRegexp (http://www.ruby-doc.org/core-1.9.3/Regexp.html) > have a example > you need str.scan /#{s}/ I'd prefer to pass a Regexp instance directly in the variable: # any of these will do r = /./ r = Regexp.new '.' r = /#{s}/ str.scan r do |match| ... end Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/