[Templates] Replacing literal back slashes

mark addison mark.addison at itn.co.uk
Sat Mar 1 19:38:58 GMT 2008


Clinton Gormley wrote:
>> Try putting the \\n inside of single quotes. The \\n is probably being
>> interpolated twice. Once inside the double quotes "" to be \n and then
>> one more time inside of the regular expression.
>>     
Had tried the single quotes but hadn't thought the extra layer of 
interpolation through properly, good point.
> In fact, it's even more than that.  To get it to work, you need to use
> this:
>
> [% Foo.replace: [% foo.replace('\\\n',"\n"); %]
>
> I would consider this a bug
>   
Aha that got it. Looks like a bug (and a bit odd) to me too.

Cheers guys,
mark
--





More information about the templates mailing list