From: David Alan Black Date: 2001-07-16T20:19:49+09:00 Subject: [ruby-talk:17912] Re: regular expressions and string#sub! Hello -- On Mon, 16 Jul 2001, Yukihiro Matsumoto wrote: > Hi, > > In message "[ruby-talk:17900] Re: regular expressions and string#sub!" > on 01/07/16, David Alan Black writes: > > |Since I can't puzzle it out, I can't say whether it's a bug :-) > |But if it's not a bug, I'm not sure what it thinks it's doing. > > See page 376 of the Pickaxe book. I'm grad we have a wonderful book > and great authors. Thank you, Dave and Andy. So *that's* where it was hiding :-) I only went as far as an empirical test, which suggested (wrongly) that backwhacking wasn't going on: p x.sub(/during/,"\\\'") => "before after after" p x.sub(/(d)uring/, "\\\1") => "before \\\001 after" ([wrong] conclusion: if \' exists, this wouldn't be it anyway, since the drop-in replacement with 1 doesn't work.) The discrepancy disappears if one uses %q{\'} and %q{\1}. An interesting lesson in \-reduction behavior, nonetheless. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav