in reply to regex, use of lookaround for whole word filtering

I believe that the following regex should do the job.

/^(?!.*neither).*nor.*$/mi

Replies are listed 'Best First'.
Re^2: regex, use of lookaround for whole word filtering
by ikegami (Patriarch) on Aug 10, 2010 at 22:11 UTC
    No, it disallows following instances of "neither".
    $ perl -E'say "a nor b neither" =~ /^(?!.*neither).*nor.*$/mi ?1:0' 0

      Nice catch. Didn't even test that kind of scenario.

      Took a few minutes after reading your post to realize why my suggested regex was incorrect. Another example of Perl doing what I told it to do instead of what I wanted it to do. :D