From: Nat Pryce Date: 2001-10-18T22:17:11+09:00 Subject: [ruby-talk:22710] Re: Slashes in regexp From: "Morris, Chris" > 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? You're not escaping the \ character in the string literal, so the string does not contain the character when it is scanned. irb(main):001:0> "test\page" "testpage" irb(main):002:0> "test\\page" "test\\page" irb(main):003:0> "test\\page".scan(/\\/) ["\\"] Cheers, Nat.