I am trying to create a regex that should match following cases.
if exact match of words 'first, second, third' then match should fail - but if there are any characters around it, then the string should be matched.
Also I need to avoid certain set of characters in the string. [()!=<>", ] - if these characters are part of string then match result should fail.
I looked at few examples & negative look ahead but did not get the right regex yet.
^(?!first$|second$|third$|fou rth$)[^()!=<>", ]+
desired output:
first - fail
second - fail
1first - pass
first1 - pass
1first1 - pass
fou rth - fail - it has space in between word and is from ignore list
newTest - pass
new(test - fail - since ( is not allowed character
space word - fail - since space is non allowed character
The regex needs to support case insensitive words
Any help appreciated. I am using javascript.