Python RegEx
RegEx Methods
match(pattern: str, string: str) -> Match | None
: look for first match at beginning of stringsearch(pattern: str, string: str) -> Match | None
: scan through a string for first matchfindall(pattern: str, string: str) -> List[str | Tuple[str, ...]]
: find all matches, returning entire match / tuple of subgroup matches
Match Object
Match.group(group1: int, ...) -> None | str | Tuple[str, ...]
: 0
is entire match, 1
onwards is parenthsized subgroup - If group is inside unmatched part, return
None
- If group is matched multiple times, return last match
Match.groups() -> Tuple[str, ...]
: returns all subgroups, entire match is not included