I have a regex that matches numbers and I want to get the position of the last-matching number.
This is what I got right now:
def find_last_match_pos(pattern, s):
match = None
for match in re.finditer(pattern, s):
pass
return match.start() if match else -1
Can anyone think of a more pythonic way to do it?