re
The re module provides regular expression matching.
Source:
import re
actor main(env):
m = re.match(r"(foo[a-z]+)", "bla bla foobar abc123")
if m is not None:
print("Got a match:", m.group[1])
env.exit(0)
Import the module with import re, then call functions
such as re.match(...).
re.match also accepts an optional start_pos to begin scanning at a
specific index (defaults to 0).
Output:
Got a match: foobar