>>>>> "a" == ara howard <ahoward / fsl.noaa.gov> writes:

a> s.gsub %r{([^A-Za-z])}, '\\1'	or

a> s.gsub %R{([^A-Za-Z])}, '\1'    both leave s *unchaged*

 Well, it's normal you are replacing the string by the original string
 i.e. you have written

   s.gsub(%r{([^A-Za-z])}) { $1 }


a> it seems in the first non-working case ('\\\1') that the interpolation
a> happens twice :

 well, the problem is with \\ it must be escaped twice this mean that you
must write 

  s.gsub(%r{([^A-Za-z])}, '\\\\\1')

 See the explanation in the FAQ

   9.18 How can I escape a backslash in a regexp? 


  http://www.rubycentral.com/faq/rubyfaq-9.html#ss9.18



Guy Decoux