PyDocs

Nav

Text Processing Services

Match

re

class
The result of re.search(), re.prefixmatch(), and re.fullmatch().
Match objects always have a boolean value of True.
Changed in 3.9
  • 3.9: re.Match supports [] to indicate a Unicode (str) or bytes match. See Generic Alias Type.
Members of Match

_

__getitem__
Return self[key].

e

end
Return index of the end of the substring matched by group.
endpos
The index into the string beyond which the RE engine will not go.
expand
Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.

g

group
Return subgroup(s) of the match by indices or names.
groupdict
Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.
groups
Return a tuple containing all the subgroups of the match, from 1.

l

lastgroup
The name of the last matched capturing group.
lastindex
The integer index of the last matched capturing group.

p

pos
The index into the string at which the RE engine started looking for a match.

r

re
The regular expression object.

s

span
For match object m, return the 2-tuple (m.start(group), m.end(group)).
start
Return index of the start of the substring matched by group.
string
The string passed to match() or search().
0 Examples
No examples for re/Match.
See Also
No see-alsos for re/Match
0 Notes
No notes for Match