How to use the Regex Tester
1. Enter your regular expression pattern in the Regex field (without slashes).
2. Set flags: g (global), i (case-insensitive), m (multiline), s (dotAll).
3. Paste or type your test string in the text area below.
4. Matches are highlighted inline. Scroll the match list to see details.
What is it?
Regular expressions (regex) are powerful patterns used to search, match, validate, and manipulate text. They are built into virtually every programming language and are indispensable for tasks like form validation, log parsing, and data extraction.
A regex pattern consists of literal characters, metacharacters (like ., *, +), character classes ([a-z]), anchors (^, $), and groups (()). Flags modify how matching works: g finds all matches, i ignores case, and m treats each line independently.
This tester runs entirely in your browser using JavaScript's native RegExp engine, so results are 100% consistent with JS regex behavior.
Example
Call us at 555-1234 or reach support at 800-5678 during business hours.
2 matches found Match 1: "555-1234" at index 10 Match 2: "800-5678" at index 40
Matches are also highlighted inline in the tool above — making it easy to see exactly what your pattern catches.
Benefits
Test your pattern against real input before writing code
Verify the regex actually matches what you expect with real data before embedding it in application logic.
See matches and capture groups highlighted in real time
Every match and each capture group is highlighted as you type — no guessing what your pattern captures.
Catch edge cases before they become production bugs
Test empty strings, Unicode characters, newlines, and long input in one place before your regex reaches user-submitted data.
Build complex patterns incrementally
Add one piece of your regex at a time and confirm each addition still matches correctly before moving to the next.
Frequently asked questions
What flags are supported?
g (global), i (case-insensitive), m (multiline), s (dotAll - dot matches newlines), u (unicode), y (sticky). Separate multiple flags without spaces, e.g., 'gi'.
Why are there no matches even though my pattern looks right?
Check your flags. Without the 'g' flag, only the first match is returned. Also verify escape sequences — in the pattern field, use single backslash (e.g., \d, not \\d).
Can I test named capture groups?
Yes! Named groups (?<name>...) are supported. The match details show the full match and any captured groups.
Why does my regex cause a freeze?
Catastrophic backtracking in patterns like (a+)+ can cause exponential time. Avoid nested quantifiers and use atomic groups or possessive quantifiers where possible.