Regex Tester
Test and debug your regular expressions in real-time
/
/
0 matches
Your matches will appear here...
Match groups will appear here...
Match information will appear here...
Enter a regular expression to see an explanation...
Regular Expression Cheat Sheet
Character Classes
| . | Any character except newline |
| \d, \D | Digit, non-digit |
| \w, \W | Word character, non-word |
| \s, \S | Whitespace, non-whitespace |
| [abc] | Any of a, b, or c |
| [^abc] | Not a, b, or c |
| [a-z] | Character between a and z |
Quantifiers
| * | 0 or more |
| + | 1 or more |
| ? | 0 or 1 |
| {3} | Exactly 3 |
| {3,5} | 3, 4, or 5 |
| {3,} | 3 or more |
| *?, +?, ??, {}? | Lazy versions of above |
Anchors & Groups
| ^, $ | Start/end of string |
| \b, \B | Word boundary, not word boundary |
| (abc) | Capture group |
| (?:abc) | Non-capturing group |
| (?=abc) | Positive lookahead |
| (?!abc) | Negative lookahead |
| \1, \2, etc. | Backreferences to captured groups |
Understanding Regular Expressions
Regular expressions (regex) are powerful patterns used to match and manipulate text strings. They provide a concise and flexible way to search, replace, and validate text based on specific patterns.
Key Features
- Pattern matching with metacharacters
- Character classes and ranges
- Quantifiers for repetition
- Grouping and capturing
- Lookahead and lookbehind assertions
Common Use Cases
- Form validation (email, phone, passwords)
- Log file parsing and analysis
- Text search and replacement
- Data extraction and scraping
- Code refactoring and formatting
Regex Components Explained
Anchors
^ - Start of string, $ - End of string
Character Classes
[a-z] - Lowercase letters, [0-9] - Digits
Quantifiers
* - Zero or more, + - One or more, ? - Zero or one
Special Characters
\d - Digit, \w - Word character, \s - Whitespace