Regular expressions
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)
Output:
Got a match: foobar
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
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)
Output:
Got a match: foobar