Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Writing a negative regex using =~

by kcott (Abbot)
on Oct 17, 2012 at 09:56 UTC ( #999510=note: print w/ replies, xml ) Need Help??


in reply to Writing a negative regex using =~

G'day John,

Update: My apologies. I thought I'd read your post fully - I must be going blind. You clearly did explain why you wanted to do this. Ignore the crap I wrote. Sorry!

Perhaps if you explained why you wanted to do this, you'd get a better answer. However, to do what you describe, why not just negate the result of =~:

$ perl -Mstrict -Mwarnings -E ' my $x = q{L,0010,8001149805,003,20121015,0600,267,204193,20121015,1300 +,,GBFER,204193}; my $y = q{L,0010,8001149805,003,20121015,0600,267,204193,20121015,1300 +,,XXXXX,204193}; if (! ($x =~ /(?:GBFER|GBFOO)/)) { say "match" } else { say "no match" + } if (! ($y =~ /(?:GBFER|GBFOO)/)) { say "match" } else { say "no match" + } ' no match match

-- Ken


Comment on Re: Writing a negative regex using =~
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999510]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2015-07-30 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls