How can I get the offset where a Python regular expression search found a match?

python, python-3.x, regex

Solution

>>> import re
>>> s = 'Hello, this is a string'
>>> m = re.search(',\s[a-z]',s)
>>> m.group()
', t'
>>> m.start()
5

More info can be found here.

Problem

I'm trying to get the offset of the match found using re.search(). http://docs.python.org/dev/howto/regex.html This site explains how to get offsets of match components relative to the start of the match, but doesn't say how to get the offset of the match itself in the "haystack" string.

Original source