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.