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!

Replies are listed 'Best First'.
Re^2: Negating Regexes: Tips, Tools, And Tricks Of The Trade
by ikegami (Patriarch) on Dec 07, 2006 at 16:33 UTC
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