Dev Tools/Regex Tester
Regex Tester
Test and debug regular expressions with live matching
Pattern
Test String
Matches (0 matches found)
No matches found
Regular Expressions Guide
Learn how to test and debug regular expressions
What are Regular Expressions?
Regular expressions (regex) are patterns used to match character combinations in strings. They are powerful tools for searching, validating, and manipulating text data in programming.
How to Use This Tool
- Enter your regex pattern in the pattern field
- Select the flags you need (global, case-insensitive, multiline)
- Enter or paste your test text in the test string field
- View highlighted matches and match details in real-time
Pro Tips
- Use the global flag (g) to find all matches, not just the first one
- The multiline flag (m) makes ^ and $ match line starts/ends
- Escape special characters like . * + ? with a backslash (\)
Browser Support
Regular expressions are natively supported in all modern browsers through JavaScript's RegExp object. This tool uses standard JavaScript regex syntax.
Frequently Asked Questions
Why isn't my regex matching anything?
Common issues include: forgetting to escape special characters (use \. for a literal dot), case sensitivity (add the 'i' flag), not enabling global flag for multiple matches, or the pattern syntax being incorrect. Try simplifying your pattern to isolate the issue.
What do the g, i, and m flags do?
g (global) finds all matches instead of stopping at the first one. i (ignore case) makes matching case-insensitive. m (multiline) makes ^ and $ match the start/end of each line, not just the entire string. You can combine multiple flags.
How do I match special characters like . or *?
Precede them with a backslash to escape them: \. matches a literal dot, \* matches an asterisk, \[ matches a bracket. Without escaping, these characters have special meaning in regex patterns.
What's the difference between * and + quantifiers?
* matches zero or more occurrences (the preceding element is optional), while + matches one or more occurrences (at least one required). For example, a* matches '' or 'aaa', but a+ requires at least one 'a'.
How do I capture groups in my regex?
Use parentheses () to create capture groups. The text matching each group is captured for later use. Named groups use (?<name>pattern) syntax. This tool displays captured groups in the match details section.