[Templates] Regular expression modifiers

Mark Fowler mark@twoshortplanks.com
Sat, 23 Nov 2002 20:49:01 +0000 (GMT)


On Sat, 23 Nov 2002, Andrew Beattie wrote:

> Is there any way to specify the /i modifier to my regular expression?
>
> I'm thinking somthing along the lines of:
>
> [% somestring.match('https?://').i ? "looks like an URL" : "just some text" %]

As this is just a normal regular expression, you can simply do this

  [% somestring.match('(?i)https?://') ...

To turn on case insensitivity, see perldoc perlre for more info.

Hope that helps.

Mark.

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              mark@twoshortplanks.com
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}