I want to get all the words, except one, from a string using JS regex match function. For example, for a string testhello123worldtestWTF
, excluding the word test
, the result would be helloworldWTF
.
I realize that I have to do it using look-ahead functions, but I can't figiure out how exactly. I came up with the following regex (?!test)[a-zA-Z]+(?=.*test)
, however, it work only partially.