import re
line = 'Here is my probblem, brother!'
t = re.findall('..b', line)
print(t)
This prints:
['rob', ', b']
But it should find 'obb' in 'probblem'. Why?
import re
line = 'Here is my probblem, brother!'
t = re.findall('..b', line)
print(t)
This prints:
['rob', ', b']
But it should find 'obb' in 'probblem'. Why?
Because . will match one character, and in this case you have 'ro' and ', ' which are followed by one b. And with regards to this point that finall() function doesn't match overlapped patterns if you want to match such patterns, you can use a positive look ahead and put your pattern in a capture group :
>>> t = re.findall('(?=(..b))', line)
>>> t
['rob', 'obb', ', b']