If the user enters exactly "null", I want the regex match to fail. Entering "xxxnullxxx" is ok however.
The following regex rejects "null" but it also rejects any string containing "null", which I don't want.
^(?!.*null).*$
Add $ and remove .* from the look ahead:
^(?!null$).*
The trailing $ isn't needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With