On 9/18/2011 9:38 PM, Jer A wrote:
All,

lets say i want to test if a string contains "pig" but not "dog" and/or not "cat"

i tried something like this:

 =~ m/[^dog]|[^cat]|pig/ig

what is the best way of going about this, using one regex?

your help is very much appreciated,

perhaps the following:
if ($s =~ m/((dog|cat)?.*pig.*(dog|cat)?)/ig &&  $1 == pig)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to