On 02/17/2010 01:00 PM, Tosh Cooey wrote: > Sorry Chad you're right, that was a working example, try this: > > dev:~# tpage > output > > [% link = 'http://site.com?oops' %] > [% linkText = 'http://site.com?oops' %] > [% ahref = '<a href="' _ link _ '">' _ linkText _ '</a>' %] > [% bodyText = "Some text waiting for link insertion, > http://site.com?oops" %] > > [% bodyText.replace(linkText, ahref) %] > > > dev:~# cat output > Some text waiting for link insertion, http://site.com?oops
I'm still not entirely clear what you're expecting to see and what you think is wrong. However, the first argument to the replace vmethod is a regex. And a ? character has a special meaning in a regex. If you want a ? to be seen as a "real" ? in a regex then you'll need to escape it (with a backslash). Either use the (Perl) quotemeta function, or the \Q ... \E escapes in your regex. Dave... _______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
