From: James Edward Gray II Date: 2005-05-18T08:36:29+09:00 Subject: Re: Variable substitution in a regex On May 17, 2005, at 6:24 PM, Scott Pack wrote: > Hi, > > I am new to Ruby. Can I substitute the value of a > variable into a regular expression? For example: > > exp = /(\d+)/ #works > exp = /(\d+)/ + 'some string value' #Not! Yes, the same way you interpolate in strings: exp = /(\d+)#{'some string value'}/ Hope that helps. James Edward Gray II