irc.perl.org #tt was very helpful today, pointing out that I *can* use $1 in replace(). I didn't know that, since the documents didn't mention it. (I assumed $1 would not work.)
Here's a patch off of trunk that explicitly shows () and $1 used. Cheers, j Template2/docsrc/src/Manual> svn diff VMethods.tt2 Index: VMethods.tt2 =================================================================== --- VMethods.tt2 (revision 1112) +++ VMethods.tt2 (working copy) @@ -35,8 +35,11 @@ as a Perl regular expression) with the second. [% name = 'foo, bar & baz' %] - [% name.replace('\W+', '_') %] # foo_bar_baz + [% name.replace('\W+', '_') %] # foo_bar_baz + [% name = 'FooBarBaz' %] + [% name.replace('([A-Z])', ' $1') %] # Foo Bar Baz + =item remove(pattern) Outputs the string with all instances of the pattern (specified _______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates