Re
The `re` module provides regular expression operations for pattern matching and text processing. The guide walks through Finding Matches, Replacing & Splitting, Flags. `re.search()` finds the first match anywhere. `re.match()` checks only at the start. `re.fullmatch()` requires the entire string to match. `re.findall()` returns all matches as a list. `re.sub()` replaces matches with a string. `re.subn()` also returns the count. `re.split()` splits by the pattern. Use `re.escape()` to treat a literal string as a pattern. `re.IGNORECASE` case-insensitive matching. `re.MULTILINE` makes `^`/`
Re — Python Tutorial & Guide | Python Reference
match line boundaries. `re.DOTALL` makes `.` match newlines. `re.VERBOSE` allows whitespace in patterns. The guide is organized into 3 sections that build on each other, each pairing a prose explanation with runnable code. Browse the individual functions covered by this guide in the
Regex Module category. Key APIs covered include
re.search(),
re.match(),
re.fullmatch(),
re.findall(),
re.finditer(),
re.sub(). Related guides:
builtins,
string,
list,
dict,
os.