I am struggling to find a certain word in a sentence. For instance, If I have a this sentence 'look toward cage again'
import re
pattern = r'again'
text = 'look toward cage again'
matchOB = re.search(pattern , text)
if match0B:
print('True')
This code returns True, however
pattern = r'aga'
text = 'look toward cage again'
matchOB = re.search(pattern , text)
if match0B:
print('True')
This code also returns True. I want to return only if it is completely matched with word not with characters.
It would be really appreciated if it is explained in detail.