Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: regex negation without !~

by RMGir (Prior)
on May 24, 2007 at 19:59 UTC ( [id://617327]=note: print w/replies, xml ) Need Help??


in reply to regex negation without !~

Would
/^(?!FOO)/
do what you want? From the perlre description, it looks like a negative lookahead is exactly what you're looking for (pun somewhat intended...)

Mike

Replies are listed 'Best First'.
Re^2: regex negation without !~
by ikegami (Patriarch) on May 25, 2007 at 02:10 UTC

    Just to be clear, that doesn't work if the original expression doesn't start with ^.

    >perl -le"print 'abc' !~ /b/ ?1:0" 0 >perl -le"print 'abc' =~ /^(?!b)/ ?1:0" 1 >perl -le"print 'abc' =~ /(?!b)/ ?1:0" 1

    That may not be an issue in this case.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-22 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found