From: james.d.masters@... Date: 2007-06-12T04:50:17+09:00 Subject: Re: why gsub! doesn't work in my script On Jun 11, 10:49 am, Li Chen wrote: > 2) I modify my codes and I get the expected results. But the odd is that > I have to use 3 backslashes before the 2nd 2. How to explain this. This is because the 2nd string can use \1, \2, etc... as a replacement for a previous match in the 1st string (matches are specified in the 1st string in parentheses). This topic was discussed here a few days ago: http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/78325335e89ce302/c99e5dda10c017fb#c99e5dda10c017fb