[Templates] Filters + replace
Sergey Martynoff
sergey@martynoff.info
Fri, 28 Jul 2006 18:44:16 +0400
> > - I have tried to do [ INCLUDE filename | replace( 'soemregex',
> > '<h2>$1</h2> ) but the $1 bit doesnt seem to work
>
> Which version of TT are you using? The $1..$n substitution
> does work in
> latest TT distribution (2.15), but unfortunately is not
> documented yet.
Ow, sorry for disinformation. Since TT 2.15 the $1 substitution works in
'replace' virtual method, not in 'replace' filter. So, you can do this:
[%
tmp_var = INCLUDE filename;
tmp_var.replace( 'some(reg)ex', '<h2>$1</h2>' )
%]
And this should work.
--
Sergey Martynoff