Sergey Martynoff wrote:
> But what about support for backslash-escaped '$' sign
in replace
> string? It seems to be achieved quite easily, changind
the line
> where actual replace takes place:
>
>> $matched =~ s/$$i/$backref/g;
>
> with this:
>
> $matched =~ s/(?<!\)$$i(?!d)/$backref/g;
>
> This also solves probles with "unused"
backreferences, when you
> use something like
replace("(this)","that$10") ending up
with
> "that0" instead of desired "that".
I saw this in Paul's code as well. I think it's a pretty
good idea,
but there is one thing to point out. It gives the user the
impression
that escaping is valid in replacement.
For example if the string is '\$3' what then? Do we escape
the
backslash. This could be a slippery slope, but for now I'm
fine with
saying '$' and '\$' are both invalid for backrefs for now.
Given that '$' is used quite a bit for money, I think it's
probably a
good thing to allow escaping.
-- Josh
_______________________________________________
templates mailing list
templates template-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
|