How to find all words followed by symbol using Python Regex?
python, regex, whitespace
Solution
'(\w+)\s*=\s*'
re.findall('(\w+)\s*=\s*', 'I think Python=amazing') \\ return 'Python'
re.findall('(\w+)\s*=\s*', 'I think Python = amazing') \\ return 'Python'
re.findall('(\w+)\s*=\s*', 'I think Python =amazing') \\ return 'Python'
Problem
I need `re.findall` to detect words that are followed by `a "="` So it works for an example like ``` re.findall('\w+(?=[=])', "I think Python=amazing") ``` but it won't work for "I think Python = amazing" or "Python =amazing"... I do not know how to possibly integrate the whitespace issue here properly. Thanks a bunch!