in reply to negative regex without !~

This should do it:

/^(?!.*$pattern)/;

If the string can include newlines there are a couple of ways to replace the '.' without changing the meaning of $pattern:

/^(?!.*(?-s:$pattern))/s; /^(?![\d\D]*$pattern)/;

Hugo

Replies are listed 'Best First'.
Re^2: negative regex without !~
by mbr (Sexton) on Jul 22, 2004 at 17:37 UTC
    That is exactly what I was looking for. Thanks.