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
In reply to Re: negative regex without !~
by hv
in thread negative regex without !~
by mbr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |