Staging: this is not the live site, pydocs.org.
Compiled regular expression object.
Changed in 3.9
- 3.9: re.Pattern supports [] to indicate a Unicode (str) or bytes pattern. See Generic Alias Type.
Members of Pattern
f
- findall
- Return a list of all non-overlapping matches of pattern in string.
- finditer
- Return an iterator over all non-overlapping matches for the RE pattern in string.
- flags
- The regex matching flags.
g
- groupindex
- A dictionary mapping group names to group numbers.
- groups
- The number of capturing groups in the pattern.
p
- pattern
- The pattern string from which the RE object was compiled.
- prefixmatch
- Matches zero or more characters at the beginning of the string.
s
- search
- Scan through string looking for a match, and return a corresponding match object instance.
- split
- Split string by the occurrences of pattern.
- sub
- Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
- subn
- Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.