PyDocs

Nav

Text Processing Services

Match.group

re

method of Match
  • Match.group([group1, ...])
group([group1, ...]) -> str or tuple.
Return subgroup(s) of the match by indices or names.
For 0 returns the entire match.
1 Example
>>> m = re.search(r"\A(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
>>> m.group(0)       # The entire match
'Norwegian Blue'
>>> m.group(1)       # The first parenthesized subgroup.
'Norwegian'
>>> m.group(2)       # The second parenthesized subgroup.
'Blue'
>>> m.group(1, 2)    # Multiple arguments give us a tuple.
('Norwegian', 'Blue')
from the Python docs
See Also
No see-alsos for re/Match.group
0 Notes
No notes for Match.group