Regex Tester
Test JavaScript RegExp patterns with flags g, i, and m—see matches, groups, and optional replace in your browser.
Result
Tips
Flags
Use g for all matches, i for case-insensitive matching, and m for multiline ^/$ behavior.
Escaping
Escape special characters like . * + ? [ ] ( ) with a backslash when you need a literal match.
Capture groups
Parentheses create groups you can see in the match list and reference in replace (for example $1).
Browser engine
Patterns are compiled with new RegExp(pattern, flags)—the same ECMAScript flavor as your browser.
Match list and groups
See which substrings matched and any capture groups the pattern produced.
Optional replace preview
Fill Replace With to preview String.replace output without changing your source elsewhere.
Invalid pattern feedback
Syntax errors from the RegExp constructor are shown so you can fix the pattern.
What this tool does
Regex Tester compiles your pattern with optional g, i, and m flags, then applies it to a test string using the browser’s JavaScript RegExp engine.
You get a match list (and groups when present) plus an optional replace preview—useful for debugging patterns before putting them in code.
How to use
Enter a pattern
Type a regular expression such as \d+ or [a-z]+ in the pattern field.
Toggle flags
Enable g, i, and/or m as needed for global, case-insensitive, or multiline matching.
Paste a test string
Add the sample text you want to match against.
Review matches or replace
Inspect the match list and groups, or fill Replace With to preview the substituted result.
Supported inputs and output
Input: a pattern string, flag checkboxes (g/i/m), a test string, and an optional replacement string.
Output: match results (including groups when available), an error message for invalid patterns, and—when replace is filled—the replace result text.
Processing and privacy
All matching uses client-side JavaScript. Your pattern and sample text are not posted to Toolomix for this tool.
Results depend on the RegExp implementation in the browser you are using.
Limitations
Known limits
- ECMAScript / JavaScript flavor only—not PCRE, .NET, or Python
- Only g, i, and m flags in the UI
- Catastrophic backtracking on pathological patterns can freeze the tab
- No server-side validation against other language engines
- Replace preview is for testing; it does not edit files on disk
Troubleshooting
If you see an error, check unbalanced brackets, unescaped special characters, or invalid flag combinations in the pattern.
If matches look incomplete, enable g. If case differs, enable i. For ^/$ line behavior, enable m and verify your line endings.
Frequently Asked Questions
Which regex flavor is used?
JavaScript (ECMAScript) via new RegExp(pattern, flags) in your browser—the same engine used by most front-end code.
Which flags are available?
The UI exposes g (global), i (ignore case), and m (multiline). Other flags are not offered in the checkboxes.
What happens with an invalid pattern?
If RegExp construction fails, the tool shows an error instead of a match list so you can correct the syntax.
Can I use capture groups in replace?
Yes. When Replace With has a value, the tool runs text.replace(re, replaceWith), so references like $1 work as in JavaScript.
Why do I only see one match?
Without the g flag, matching stops after the first hit. Enable g to collect all matches.
Is my pattern or test string uploaded?
No. Matching and replace run in the browser. There is no server call for this tool.
Are lookaheads or lookbehinds supported?
Support matches whatever your browser’s JS engine implements. Modern browsers typically support lookaheads and lookbehinds.
Try Other Free Tools
Try it now
Write a pattern, set g/i/m, paste sample text, and inspect matches or replace output.