From: Adam Bozanich Date: 2007-04-26T17:09:42+09:00 Subject: [patch] gsub with backslash characters in replacement string ------=_Part_112402_9645768.1177574978905 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, spotted this one the other day: irb(main):001:0> '\\'.gsub('\\','\\\\') => "\\" irb(main):002:0> '\\'.gsub('\\','\\\\\\') => "\\\\" The following patch seems to fix things on my system -Adam Index: re.c =================================================================== --- re.c (revision 12221) +++ re.c (working copy) @@ -2151,10 +2151,6 @@ if (no == 0) continue; break; - case '\\': - rb_str_buf_cat(val, s-1, 1); - continue; - default: rb_str_buf_cat(val, s-2, 2); continue; ------=_Part_112402_9645768.1177574978905 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, spotted this one the other day:

irb(main):001:0> '\\'.gsub('\\','\\\\')
=> "\\"
irb(main):002:0> '\\'.gsub('\\','\\\\\\')
=> "\\\\"

The following patch seems to fix things on my system

-Adam

Index: re.c
===================================================================
--- re.c        (revision 12221)
+++ re.c        (working copy)
@@ -2151,10 +2151,6 @@
            if (no == 0) continue;
            break;
 
-         case '\\':
-           rb_str_buf_cat(val, s-1, 1);
-           continue;
-
          default:
            rb_str_buf_cat(val, s-2, 2);
            continue;

------=_Part_112402_9645768.1177574978905--