Hello!

Regular expressions are a powerful part of Perl. However, I 
can't seem to get the same power in the toolkit. When I try the 
virtual function 'replace', it doesn't seem to have the ability 
to identify groups (identified by parenthesis () ) and insert 
them into the output text the way perl does. 

That is, if I'm looking for embedded tags in a string like:

  "This is [my] embeded [string]"

with Perl I could say

  $text =~ s/[(.*?)]/@$1@/

and have the text become

  "This is @my@ embeded @string@"

But the virtual function 'replace' doesn't seem to know how to 
find groups and then insert them this way. Or maybe it does, but 
the syntax isn't documented well enough.

When I try to do it using the PERL directive, I get a message 
saying that it doesn't like the tilde (~) in the text:

  ! file error - parse error - xyz.html line 24: 
       unexpected token (~)

So it doesn't like the tilde in the =~ structure when used 
inside of a PERL/END directive.

Is there any way to get the regular expression parsing of Perl 
into the toolkit?

Thanks!
Mark


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to