Q: How to write regular expression NOT matching anything that has substring "ab" ?
A:
    ([^a]*|a[^b]|a$)*
Add '^'..'$' to taste.
Q: How to write regular expression NOT matching anything containing "abcd" ?
A:
    ([^a]*|a{0.2}$|a[^b]|ab[^c]|abc[^d])*
Again, add '^'..'$' to taste.