I need to filter some lines containing several tabs at the end of the string using a regex. To do so, I wrote the following code:
import re
s = 'text:\t\t\t\t\t'
preg = re.compile(r':\s*$')
print(preg.match(s))
Which prints None
indicating that no match was found. For further investigation I jumped over to regex101.com in order to test the regex more comfortably, which in contrast to Python returns a match as desired.
Where's the problem here? What am I doing wrong?