PyDocs

Nav

Text Processing Services

Pattern.search

re

method of Pattern
  • Pattern.search(string[, pos[, endpos]])
Scan through string looking for a match, and return a corresponding match object instance.

Return None if no position in the string matches.
1 Example
>>> pattern = re.compile("d")
>>> pattern.search("dog")     # Match at index 0
<re.Match object; span=(0, 1), match='d'>
>>> pattern.search("dog", 1)  # No match; search doesn't include the "d"
from the Python docs
See Also
No see-alsos for re/Pattern.search
0 Notes
No notes for Pattern.search