I'm using Python 3.9. I want to determine if a word from an array is in another string. I have
words = ['i', 'we', 'my', 'our', 'mine']
so this
title1 = "My mind"
should contain at least one word (the word "my"), but when I tried to write a regex it failed ...
>>> result = any(re.search(r'\b' + word + '\b',title1.lower()).group(0) for word in words)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in <genexpr>
AttributeError: 'NoneType' object has no attribute 'group'