From: Florian Gross Date: 2005-02-18T21:59:47+09:00 Subject: Re: Newbie needs help with escaping regex Logan Capaldo wrote: > An alternative is to use %r{} syntax. > > %r{(now|I)can (use)+ as many /* as I? want} > > Of course the downside being is now you have to escape { }. But your > pattern doesn't seem to contain any of those anyway. It's not a problem as long as they are balanced: irb(main):004:0> %r{foo{0,1}} => /foo{0,1}/ So %r with one of the paired delimiters is usually a pretty good choice if you want to avoid escaping. Especially since you have to escape (, ), { and } in Regexps anyway if they don't appear in one of the meta constructs in which case they would be balanced anyway.