PyDocs

Nav

Text Processing Services

Pattern.prefixmatch

re

method of Pattern · Added in 3.15
  • Pattern.prefixmatch(string[, pos[, endpos]])
Matches zero or more characters at the beginning of the string.
1 Example
>>> pattern = re.compile("o")
>>> pattern.prefixmatch("dog")     # No match as "o" is not at the start of "dog".
>>> pattern.prefixmatch("dog", 1)  # Match as "o" is the 2nd character of "dog".
<re.Match object; span=(1, 2), match='o'>
from the Python docs
See Also
No see-alsos for re/Pattern.prefixmatch
0 Notes
No notes for Pattern.prefixmatch