From: Belorion Date: 2005-04-19T01:58:04+09:00 Subject: String.sub strangeness Forgive me if my Monday fog is preventing me from seeing the simple answer to this simple problem... irb-enhanced(main):001:0> str = "123&456" => "123&456" irb-enhanced(main):002:0> str.sub( /\&/, "\\&" ) => "123&456" irb-enhanced(main):003:0> str.sub( /\&/, "\\!" ) => "123\\!456" Why am I not able to escape the & in the string with an a \ ? If I do this: irb-enhanced(main):004:0> str.sub( /\&/, "\\\\&" ) => "123\\&456" It seems to work... I'm not sure I understand the (apparent) inconsistency.