I have a regex that matches these strings in a string; however, it is matching non-words ( parts-of-words ) as well.
For example city
is matched as it contains it
. However, I want only the string it to be matched it if it the only characters between whitespace. So it
or he
would match, but not city or where.
Here is the regex ( pretty basic and simple ): they|he|she|her|him|them|it
.
How can I get it to match these words if the word is only this?