From: Alia Amin Date: 2002-10-29T19:13:17+09:00 Subject: Re: gsub and "\\" Hello, "a".gsub("a","\\\\8?") >> "\\8?" hth, Alia coma_killen@fastmail.fm wrote: >Hi, > >I'm a bit confused on how to use gsub when the string I want >to substitute for can contain "\\" and "?" etc. > >Examples: > >"a".gsub("a", "\\8") => "" (but I want "\\8") > >so I thought maybe I can use Regexp.escape > >"a".gsub("a", Regexp.escape("\\8")) => "\\8" (great!) > >but now if there is a question mark it won't work > >"a".gsub("a", Regexp.escape("\\8?")) => "\\8\\?" but I want >it to be "\\8?" > >I guess there is a simple solution but I can't see it right >now. Any help appreciated! > >Regards, > >Karsten Magnuauer > > >-- >http://fastmail.fm - Same, same, but different... > > > >