re.match
implicitly adds ^
to the start of your regex. In other words, it only matches at the start of the string.
re.search
will retry at all positions.
Generally speaking, I recommend using re.search
and adding ^
explicitly when you want it.