From: Ian Macdonald Date: 2003-05-30T06:58:35+09:00 Subject: substitution weirdness Hi, Here's some behaviour I don't immediately understand: irb(main):119:0> foo = "'123" => "'123" irb(main):120:0> foo.gsub(/'/, "\\'") => "123123" Why does the apostrophe get replaced with a copy of the text that follows it? I'm trying to replace every instance of ' with \' but it's proving very tricky. Nothing I can come up with seems to work, no matter how many backslashes I use, whether I use single or double quotes, whether or not I use gsub with a block, etc. This should be so easy, but it has me stumped. Ian -- Ian Macdonald | It is better to live rich than to die rich. System Administrator | -- Samuel Johnson ian@caliban.org | http://www.caliban.org | |