Regex tester
Regex tester is a developer tool that runs JavaScript regular expressions against test input. It lists each match with its position and capture groups, supports the g, i, m, s, u and y flags, and offers match, replace, and split modes. The tool runs in your browser.
//
Test string
0 matches
Enter a pattern and test string above
MODE
Runs entirely in your browser
Dedicated pages
Direct links for each regex mode.
Regex match tester
Test regular expressions against strings and see all matches highlighted. Supports JavaScript regex flags: g, i, m, s, u, y. Runs in your browser.
Regex replace with capture groups
Find and replace text using regular expressions. Supports capture groups, backreferences, and the g, i, m, s, u and y flags. Runs in your browser.
Regex split
Split text on a regex and see each part in a numbered list, with empty parts marked. Useful for log lines and delimited strings. Runs in your browser.
Regex Replace Tool
Find and replace text with regular expressions. Use $1, $2 and $& in the replacement, with the g, i, m, s, u and y flags. Runs in your browser.
JavaScript Regex Tester
Test JavaScript regular expressions against any input in your browser. Live highlights, g/i/m/s/u/y flags. Free, runs in your browser.
How to test a regular expression
- Type the pattern at the top, without the surrounding / characters.
- Toggle flags with the buttons next to it: g (on by default), i, m, s, u and y.
- Paste or type up to 5,000 characters in the Test string box.
- Pick Match, Replace or Split in the side panel. In Replace mode, type the replacement, using $1, $<name> or $& for captured text.
- Read the results as you type: each match with its index and groups, the replaced text, or the numbered split parts.
- Click Copy result to copy the output.
Common uses
- Testing a regex pattern against sample data before using it in production code, use text diff to compare the original and transformed text after a replace operation
- Building and debugging regular expressions interactively with instant feedback
- Extracting captured group values to verify that named or numbered groups work correctly. The JSON formatter is useful when the captured output is JSON
Technical specification
- Algorithm or formula: JavaScript (ECMAScript)
RegExpengine, executed inside a dedicated Web Worker with a 2-second wall-clock timeout to abort runaway catastrophic backtracking. - Browser API or library: Native
RegExpcompiled in the worker; one bundledWorker, started with the page and reused between runs, replaced only after the timeout or when new input arrives while a run is still going; the page renders the results as text, never as HTML. - Input limits: Test input up to 5,000 characters. Worker timeout 2 seconds.
- Output: List of matches with their position and numbered and named capture groups, replace output, and split parts.
- Known limitations: ECMAScript flavor only; PCRE, Python, and .NET features (e.g., conditional patterns, recursion) are not supported. Patterns that exceed the 2-second timeout return an error.
Frequently asked questions
- Which regex flavour does this tester use?
- JavaScript (ECMAScript) regex. The g, i, m, s, u and y flags are supported, along with named capture groups, lookahead and lookbehind. Some patterns written for PCRE, Python, or .NET have minor syntax differences. All matching runs in your browser using the native RegExp engine.
- Is my data sent to a server?
- All regex matching happens in your browser using the native RegExp engine. Our servers are not involved at any point.
- Can I test regexes with named capture groups?
- Yes. Each match in the list shows its named groups by name ($<name>) as well as by number ($1, $2).
- Why does my regex behave unexpectedly with the g flag?
- In this tester, g decides how many matches you get: with g on (the default) the Match list shows every match and Replace changes every occurrence; with g off you get only the first. Split ignores g. In your own code, surprises usually come from reusing one global RegExp across test() or exec() calls, because it remembers lastIndex between calls; this tester builds a new RegExp on every run.
Related tools
Find & replace
Find and replace text with plain search or regular expressions. Supports case-sensitive and whole-word matching.
SQL formatter
Beautify and format SQL queries. Supports MySQL, PostgreSQL, T-SQL and standard SQL.
Cron expression explainer
Parse any cron schedule into plain English and see the next run times. Fully in-browser.
- Background reading: Complete guide to developer tools
Reviewed and tested September 30, 2026.