[Templates] Correct replace vmethod

Josh Rosenbaum josh@infogears.com
Wed, 01 Feb 2006 21:47:21 -0700


Sergey Martynoff wrote:
>> I have created a simple test, which compares results of native
>> perl s/// (via eval) and proposed template 'replace' vmethod.
> 
> After thinking a bit, I understand that trying to recreate perl
> s/// behavior in details is a bad idea. I think that reasonable
> level of details is simulating perl's $1, $2 etc backreferences,
> with possibility to escape $ with backslash, and to escape
> backslash itself before $1 (etc). So I throw out \1, \2 tests from
> my vmeth_replace.t and added some other tests. You can find it
> here: http://martynoff.info/tt2/

Yes, I was just about to fire off an email about how it would be bad 
to support \1, \2, etc. If I remember correctly, the perl docs 
themselves frown upon that usage, and it's basically only there for 
backward compatibility.

Thanks for the test file. I might give it a shot tomorrow.

-- Josh