Results are provided for informational purposes only and may contain errors. Please verify important information independently. Use of this tool is at your own risk.
What the Regex Tester does
The Regex Tester runs a JavaScript regular expression against your text as you type. Every match is highlighted, the total number of matches is shown, and if the pattern has capture groups the value of each group ($1, $2 ...) is listed for every match. A syntax error in the pattern is shown immediately instead of a result.
Write the pattern without slashes and put flags such as i (ignore case), m (multi-line anchors), s (dot matches newlines) or u (Unicode) in the flags box. The g flag is always added, so the tester finds every match rather than stopping at the first. Everything runs in your browser with the same engine your JavaScript code uses.
When to use it
- Building a validation pattern for a form field and checking it against good and bad samples.
- Extracting dates, IDs or URLs from logs before writing a script.
- Debugging a search-and-replace in an editor that uses regex.
- Learning how groups, anchors and quantifiers behave with real text.
Worked example
Input
Pattern: (\d{4})-(\d{2})-(\d{2})
Text: Order #1042 shipped on 2026-03-14, order #1043 on 2026-03-15.
Output
2 matches
Match 1 groups: $1=2026 $2=03 $3=14
Match 2 groups: $1=2026 $2=03 $3=15Common questions about the Regex Tester
Does it work for Python, PHP or Java regex?
The basics (character classes, quantifiers, groups, anchors) are the same in most languages. Some features differ, such as lookbehind support and named-group syntax, so test in the target language before relying on advanced syntax.
Why does my pattern match an empty string many times?
Patterns such as a* can match zero characters, so they succeed at every position. Use + instead of * when at least one character is required.
How do I match a literal dot or bracket?
Escape it with a backslash: \. matches a dot and \[ matches an opening bracket. Without the backslash, . matches any character.
Can I test a replacement?
The tester shows matches and groups. To see the effect of a replacement, use the groups in your code, for example text.replace(re, '$3/$2/$1'), and compare the before and after with the Text Diff Checker.
Is this tool free?
Yes, it's free to use. No signup, no email required. Get results on this page.
How do I get my result?
Use the tool on this page. Your result appears here; no email delivery is required.