[Chicago-talk] using a regex in a variable
Ed Summers
ehs at pobox.com
Fri Oct 24 09:25:50 CDT 2003
On Fri, Oct 24, 2003 at 09:16:23AM -0500, Jay Strauss wrote:
> Because I need to be able to dynamically use a different regex (which I look
> up in my db) under different conditions
So let's say you've got this regex stored in your DB.
s/SCO/IBM/
and you've extracted it, stored it in $regex, and you want to match it against
$string.
eval( '$string =~ ' . $regex );
should do the trick. I was wondering if there was anything like qr// for
substitution but a quick glance in the Camel didn't turn up anything.
Just make sure they don't store this regex in your db:
's/SCO/IBM/; unlink $0;'
:)
//Ed
More information about the Chicago-talk
mailing list