Regular Expressions
Overview
Regular Expressions (Regex) define search patterns to extract or validate matching parts of texts.
When to Use This Skill
Use to extract emails, parse URLs, clean user inputs, or extract variables from raw HTML.
Quick Start (with runnable code examples)
import re
text = "Find me at akim.221992@gmail.com and also lordegypt@github.com"
# Extract all email patterns
emails = re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', text)
print("Emails found:", emails)
Advanced Usage
Design complex regex configurations with named lookarounds, non-capturing groups, and multi-line flag patterns.
Key References
Dependencies
- Python Standard Library