Regex to match a sentence that does not contain the word "test"

These file types must not be the same:

abcd_test.py
test.py
xyz_test.js
test.js

      

Everything else should match.

What would be the regex for this?

+3


source to share


1 answer


(?!.*?test)^.*$

      

this should do it.



See demo.

http://regex101.com/r/qS7yN9/1

+7


source







All Articles