Python Function Reference

re.search
Scan through string looking for the first location where the regular expression pattern produces a match.
Python 3.13
re.search(pattern, string, flags=0)
pattern
The regular expression to search for.
string
The string to scan.
flags
Flags that modify the expression`s behavior (e.g., re.IGNORECASE).
Examples
Python 3.13
>>> import re
>>> re.search(r'\bworld\b', 'hello world')
<re.Match object; span=(6, 11), match='world'>