From: Mark Hubbart Date: 2004-04-27T02:59:42+09:00 Subject: Re: Variable matching On Apr 26, 2004, at 4:32 AM, Thomas Adam wrote: > --- Rove Monteux wrote: > Hi, >> >> Quite new to regex myself, Im trying to match a chunk of the text with >> the following, >> >> chunk = content.scan(/(.*)/m) >> >> That works alright, and its contents returned to the chunk string. Now >> Im trying to do that way, >> >> $start = "" >> $end = "" >> >> chunk = content.scan(/$start(.*)$end/m) > > I haven't tested this, but you are not interpolating the variables > correctly: > > chunk = content.scan(/#{$start}(.*)#{$end}/) Also, if you are using global variables, you can eliminate the brackets. $start = "" ==>"" $end = "" ==>"" /#$start(.*)#$end/ ==>/(.*)/