Recipes: Regular expressions¶
Short, task-focused how-tos for things you'll actually use regex for. Each recipe assumes you can already read a basic pattern — if a piece of syntax surprises you, the Learn section is one click away.
Unlike the tutorials, the recipes don't have a recommended order. Pick whichever is useful right now.
Recipes in this guide¶
- Extract data from text — pulling fields, numbers, dates, and other structured bits out of unstructured input.
- Validate email addresses — a practical pattern for email validation, and why "perfect" validation is a trap.
- Use regex with file I/O — searching and substituting line-by-line through a file without loading it all at once.
- Avoid common regex mistakes — catastrophic backtracking, anchoring blunders, and other footguns.