From: Sean Chittenden Date: 2001-10-19T04:51:10+09:00 Subject: [ruby-talk:22721] Re: Slashes in regexp > ruby 1.6.3 (2001-03-19) [i386-cygwin] > > irb(main):008:0> "test/page".scan(/\//) > ["/"] > irb(main):009:0> "test\page".scan(/\\/) > [] > > What am I doing wrong in the second statement that it's not returning the > backslash? Little trick I use everywhere to get around this: re = Regexp.new(/#{Regexp.escape('\foo\bar')}/) This way I only have to escape it once for the function: Regexp.escape takes care of the rest for me. -sc -- Sean Chittenden