Regex for string not containing multiple specific words

Use a negative look-ahead that asserts the absence of any of the three words somewhere in the input:

^(?!.*(trunk|tags|branches)).*$

I also slightly rearranged your regex to correct minor errors.

Leave a Comment