On 01/03/11 20:48, Bill Ward wrote:
> I know we can use a filter to convert to lower case, [% foo | lower %]
> but that only works for output. What I want is to do a case-insensitive
> [% IF %] test, and normally in Perl I would just lc($foo) and compare
> that to the desired value. But how to do that in a template?
>
> --
> Check out my LEGO blog at http://www.brickpile.com/
> View my photos at http://flickr.com/photos/billward/
> Follow me at http://twitter.com/williamward
>
>
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
You could try a regex match. The following outputs 'foobar':
[% foo = 'Bar' %]
[% 'foobar' IF foo.match('(?i)^bar$') %]
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates