From: Mike Stok Date: 2013-05-29T20:35:36+09:00 Subject: Re: AAARRRRGH! s="#$" => SyntaxError: compile error On 2013-05-29, at 6:29 AM, Tadeusz Bochan wrote: > Ooops. Spoke too soon. The workaround doesn't. > > "xyz#abc".gsub("#","\\043") => "xyz#43abc" > > -- > Posted via http://www.ruby-forum.com/. There are a couple of ways to do that: [1] pry(main)> puts "xyz#abc".gsub("#","\\\\043"); xyz\043abc [2] pry(main)> puts "xyz#abc".gsub("#") { '\\043' }; xyz\043abc There's an explanation of how the replacement string is double interpolated at http://www.ruby-forum.com/topic/143645 Hope this helps, Mike -- Mike ᒩ Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply.