Regular Expressions Cheat Sheet
# Regular Expressions Cheat Sheet
## Anchors
- `^` โ Start of string
- `$` โ End of string
- `\b` โ Word boundary
## Character Classes
- `.` โ Any character
- `\d` โ Digit [0-9]
- \w โ Word char [a-zA-Z0-9_]
- \s โ Whitespace
- [abc] โ a, b, or c
- [^abc] โ Not a, b, or c
- [a-z] โ Range
## Quantifiers
- * โ Zero or more
- + โ One or more
- ? โ Zero or one
- {n} โ Exactly n
- {n,} โ n or more
- {n,m} โ Between n and m
## Groups & Alternation
- (abc) โ Capture group
- (?:abc) โ Non-capturing
- a|b โ Alternation
## Lookahead/Lookbehind
- (?=...) โ Positive lookahead
- (?!...) โ Negative lookahead
- (?<=...) โ Positive lookbehind
- (?<!...) โ Negative lookbehind
## Common Patterns
- Email: ^[\w.-]+@[\w.-]+\.\w+$
- URL: ^https?://.+$
- IP: ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$