From: Hugh Sasse Date: 2006-11-24T03:21:09+09:00 Subject: Re: double-slashes in input causing trouble On Fri, 24 Nov 2006, Edwin Fine wrote: > Hugh Sasse wrote: > > On Fri, 24 Nov 2006, Jeremy Wells wrote: > >> new_body = body.sub(original_section, new_section) > > new_body = body.sub(Regexp.new(Regexp.quote(original_section)), > > new_section) [...] > >> end > > > > # Hugh > > Makes no difference. String#sub states that metacharacters in the > pattern will not be interpreted if the pattern is a String and not a > Regexp. [...] > The problem is that the backslashes in the REPLACEMENT string are being > interpreted. Oops! Hugh