re.regex.groupindex

regex.groupindex A dictionary mapping any symbolic group names defined by (?P<id>) to group numbers. The dictionary is empty if no symbolic groups were used in the pattern.

re.purge()

re.purge() Clear the regular expression cache.

re.match.start()

match.start([group]) match.end([group]) Return the indices of the start and end of the substring matched by group; group defaults to zero (meaning the whole matched substring). Return -1 if group exists but did not contribute to the match. For a match object m, and a group g that did contribute to the match, the substring matched by group g (equivalent to m.group(g)) is m.string[m.start(g):m.end(g)] Note that m.start(group) will equal m.end(group) if group matched a null string. For example,

re.match.span()

match.span([group]) For a match m, return the 2-tuple (m.start(group), m.end(group)). Note that if group did not contribute to the match, this is (-1, -1). group defaults to zero, the entire match.

re.regex.findall()

regex.findall(string[, pos[, endpos]]) Similar to the findall() function, using the compiled pattern, but also accepts optional pos and endpos parameters that limit the search region like for match().

re.match.string

match.string The string passed to match() or search().

re.match.lastgroup

match.lastgroup The name of the last matched capturing group, or None if the group didn’t have a name, or if no group was matched at all.

re.match.groups()

match.groups(default=None) Return a tuple containing all the subgroups of the match, from 1 up to however many groups are in the pattern. The default argument is used for groups that did not participate in the match; it defaults to None. For example: >>> m = re.match(r"(\d+)\.(\d+)", "24.1632") >>> m.groups() ('24', '1632') If we make the decimal place and everything after it optional, not all groups might participate in the match. These groups will default to None unless

re.match.groupdict()

match.groupdict(default=None) Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name. The default argument is used for groups that did not participate in the match; it defaults to None. For example: >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds") >>> m.groupdict() {'first_name': 'Malcolm', 'last_name': 'Reynolds'}

re.match.re

match.re The regular expression object whose match() or search() method produced this match instance.