From: Jamis Buck Date: 2003-12-24T01:14:09+09:00 Subject: Re: Strings to regexps (non-demanding post :->) James F. Hranicky wrote: > >The main reason I like this > > line.match('/usr/local/lib/blah/blah/blah') > >is so I don't have to escape forward slashes: > > line.match(/\/usr\/local\/lib\/blah\/blah/) > >I suppose writing this > > line.match(Regexp.new("/usr/local/lib/blah/blah/blah")) > >works, though a touch less elegant. No biggie, though. Perhaps there's a >better way than that? > >Jim > > > You can use %r, and then specify your own delimiter: line.match( %r|/usr/local/lib/blah/blah| ) -- Jamis Buck jgb3@email.byu.edu ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'