The free online regex tester runs a JavaScript regular expression against text and highlights every match live, with capture groups and flags. Because it runs in the browser, the text is never uploaded.
Developer tools by OnlinePCApps since 2013
A regular expression that looks right can still miss a case or match too much. The free online regex tester runs it against real text and shows every match as the pattern changes.
Writing a regex blind and hoping it works is slow. Live highlighting marks each match as the pattern is typed, so a token added or a quantifier changed shows its effect at once. The pattern is shaped against real text.
A regex that misses an edge case or matches too greedily can slip a bug into production. Testing it against real and awkward input first, with the exact matches and groups shown, catches the mistake before the code goes out.
A pattern is often tested against a log, a database dump or a sample with real records in it. The test runs in the browser, so that sample stays on the device rather than being pasted into an outside server.
Paste the text to search into the panel above, or drop a file, then type a regular expression in the pattern field. A sample pattern can be loaded as a starting point for email, a date or a URL.
Toggle the flags the pattern needs, such as g for every match, i to ignore case or m for multiline. Matches highlight live in the text, with each capture group and its position listed alongside.
Adjust the pattern until the matches are right, or switch to replace mode and use $1 and $2 to build the output. The text stays untouched, so a pattern can be tried again at any time.
To test a regex is to run a pattern against text and see what it matches. The tool does that on the device.
Every match is highlighted in the text as the pattern is typed, so the effect of each change is visible at once. A match count and the position of each hit are shown, which turns building a pattern into a quick loop of edit and see.
The flags toggle with a click, from g for every match and i to ignore case to m for multiline, s for dotAll, u for Unicode, y for sticky and d for match indices. The pattern reads as a standard /pattern/flags string.
Each match lists its capture groups, numbered from one and by name where a group uses the named form. That mirrors what the exec call returns in code, where index zero is the full match and the rest are the groups.
Replace mode runs the pattern as a substitution and shows the output, with $1 and $2 dropping the captured groups into the result. That previews a find-and-replace before it is run over a file or in code.
To test a regex, to check a regular expression and to debug a pattern all name the same task. A search for regex tester or test regex online reaches this tool, and the text is left as it is.
A regex is a pattern run against text. These points decide how it behaves and where it differs.
| The case | Result | What happens and why |
|---|---|---|
| Flags | g i m s u y d | Global, ignore case, multiline, dotAll, Unicode, sticky and match indices. |
| Capture groups | numbered | Groups from one, listed with the full match, as an exec call returns them. |
| Named groups | (?<name>) | A group can be named and read back by that name rather than a number. |
| Lookaround | (?=) (?<=) | Lookahead and lookbehind assert without consuming, both supported here. |
| Replace | $1 $2 | Substitution drops the captured groups into the output by number. |
| Engine | ECMAScript | The native JavaScript RegExp, the same as new RegExp in any browser. |
| Not PCRE | differs | PCRE features such as possessive quantifiers or recursion throw or differ. |
| ReDoS | caution | A nested quantifier on untrusted input can backtrack and hang the match. |
| Where it runs | on the device | The pattern runs in the browser, so nothing is uploaded. |
How a Regex Tester Works
A regular expression is a compact language for describing a search pattern over text, an idea that goes back to Stephen Kleene in 1956 and reached Unix through Ken Thompson and the grep tool. This tester runs the pattern on the native JavaScript engine, the ECMAScript RegExp that every browser, Node and Deno share, so a pattern behaves here exactly as new RegExp would run it in code. The flags shape the run, from g for every match and i to ignore case to m, s, u, y and d for multiline, dotAll, Unicode, sticky and match indices. Groups are captured by number and by name, lookahead and lookbehind assert around a match without consuming it, while replace mode drops the groups into an output with $1 and $2. Two honest points matter most. The first is that this is JavaScript regex, not PCRE, so a pattern built for Perl, PHP or Python may lean on a feature such as a possessive quantifier or recursion that the ECMAScript engine does not have. It will throw or behave differently here. The second is that JavaScript uses a backtracking engine, which is powerful but can hit catastrophic backtracking on a nested quantifier over hostile input, the pattern behind a class of denial-of-service bug. The references below define the engine.
Both test a regex. The trade is between a quick focused check and a deeper multi-flavour debugger.
| Point of comparison | This tool Tested in the browser On the device | A full debugger A deeper regex debugger |
|---|---|---|
| Where the text goes | Stays in the browser | Often client-side too |
| Price and caps | Free with no file cap | Free tier often capped |
| PCRE, Python or Go | JavaScript flavour only | Several flavours to pick |
| A token-by-token explainer | Matches and groups shown | Each token explained |
| A quick JavaScript test | Open and test at once | More panels to read |
A full debugger such as regex101 wins for switching flavours between PCRE, Python and Go. It can explain a dense pattern token by token. This page wins for a fast JavaScript regex test with live matches and no clutter. Both keep the text local.
The pattern is run against the text by the browser's own RegExp engine, so the work is client-side and the text stays on the machine that opened it. Nothing is handed to a server to run the match.
The text a pattern is tested against is often a real log, a database dump or a sample with live records in it. A server-side tester would take all of that on upload, needless exposure when the browser can run the match locally.
Each of these tests a regex. They vary in reach, in flavour and in where the text goes.
regex101, grep and a code console all test a regex, yet each means another flavour, the terminal or no live view. This page runs the exact JavaScript engine with live matches and groups, kept local with nothing to set up.
A little context saves a confused result.
The engine here is ECMAScript, the same as new RegExp in a browser. A pattern written for PCRE, Perl or Python may use a feature this engine lacks, such as a possessive quantifier or recursion. It will throw or behave differently.
Without the g flag, a pattern finds only the first match, which surprises many. Add g to iterate every match, and reach for i, m or s when case, line boundaries or a dot across newlines matter to the search.
JavaScript uses a backtracking engine, so a nested quantifier over hostile input can hang, the pattern behind a denial-of-service bug. Keep a pattern tight on untrusted input, and anchor it rather than leaving it open.
The browser tests a pattern against a page of text in memory, which fits building and debugging. A multi-gigabyte log, a whole codebase or a pattern inside a build belongs on grep, ripgrep or a script, which reads from disk and runs the pattern across every file.
Run a pattern over a folder or a codebase in one command, listing every file and line that matches at speed.
A multi-gigabyte log is streamed from disk and searched, past what a browser tab holds in memory at once.
A pattern runs inside a build or a hook, so a check or a bulk replace happens automatically, ready for a repeated workflow.
Free and online, with no sign-up and no upload. Test a regular expression in the browser, all on the device.