Reputation: 47
I have the following regular expression:
\b(?!^Word1$|^Word2$|^Word3$|^Word4$)\b(?![\s]+)[a-zA-Z0-9\']{2,}
When a user types 'Word1' it doesn't match, which is what I want. When the user types 'Word1 foo' the whole string matches again, which is what I want.
However, when user types 'Word1 ' (note the space) the string matches. I'd like it to remain unmatched until another word is typed and then the whole line is matched.
Upvotes: 0
Views: 56
Reputation: 249
This regular expression works only for strings with more than 1 word
\w*\s\w*
Upvotes: 1