From: Bill Kelly Date: 2005-01-20T03:52:04+09:00 Subject: Re: gsub and \\\\ From: "Florian Gross" > Bill Kelly wrote: > > > I'm probably being dense, but - > > > >>>"ab\\cd".gsub(/\\/, "\\\\") > > Here's the details, this comes up frequently: > > ..gsub adds its own layer of escaping. \1 refers to the first match, \2 > to the second and there is also stuff like \'. (In general those forms > are equivalent to global variables. E.g. \1 => $1) > > Because Ruby's String literals already have one level of escaping you > have to escape everything two times which is confusing. Argh! Thanks....!! I used to know this... :) Regards, Bill