I'm working with regex in python and I'd like to search for all the words in a string except one word. Code:
import re
string = "The world is too big"
print re.findall("regex", string)
If I want to get all the words except for the word "too" (so the output will be ["The", "world", "is", "big"]), How can I implement this in regex?
' '.join(list(filter(lambda w: w != 'too', string.split())))or' '.join(w for w in string.split() if w != 'too')^(?!too$).*