Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Negating Regexes: Tips, Tools, And Tricks Of The Trade

by Sidhekin (Priest)
on Dec 07, 2006 at 13:58 UTC ( #588318=note: print w/ replies, xml ) Need Help??


in reply to Negating Regexes: Tips, Tools, And Tricks Of The Trade

So what tools, tips, and tricks of the trade do you have to share for these rare occassions you need to write a regex that matches everything another regex doesn't?

 /^(?!(?s:.*)$regex)/

:-)

Caveat: Only useful in a boolean context.

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!


Comment on Re: Negating Regexes: Tips, Tools, And Tricks Of The Trade
Select or Download Code
Re^2: Negating Regexes: Tips, Tools, And Tricks Of The Trade
by Limbic~Region (Chancellor) on Dec 07, 2006 at 16:08 UTC
    Sidhekin,
    Very Nice!

    I admit that look around assertions, non-capturing clusters, and local modifiers are not my strong suit so I learned a bit from this one-size-fits-all solution. It would be nice if you forgot you knew how to do that though and shared other examples.

    Cheers - L~R

Re^2: Negating Regexes: Tips, Tools, And Tricks Of The Trade
by ikegami (Pope) on Dec 07, 2006 at 16:33 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-09-19 03:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls