[Chicago-talk] using a regex in a variable
Jay Strauss
me at heyjay.com
Fri Oct 24 10:42:46 CDT 2003
Thanks
that worked
Jay
----- Original Message -----
From: "Ed Summers" <ehs at pobox.com>
To: "Chicago.pm chatter" <chicago-talk at mail.pm.org>
Sent: Friday, October 24, 2003 9:25 AM
Subject: Re: [Chicago-talk] using a regex in a variable
> 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
>
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
>
More information about the Chicago-talk
mailing list