Free online regex tester. Enter a pattern, set the flags, add sample text and select Execute Regex Test. The Match Results list shows every match with its index and capture groups.
Developer tools by OnlinePCApps since 2013
A regex that looks right can still miss a case or match too much. The free online regex tester runs it against sample text and lists every match with its index and groups.
Writing a regex blind and hoping it works is slow. Run the pattern in the online regex tester, check the match list and edit. Add one token at a time and run again, so every change shows its effect on 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 exact matches and groups listed, catches the mistake before the code goes out. An online regex tester gives that check in seconds.
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.
Type a regular expression in the Regular Expression Pattern field. Paste sample text into the Test Sample Text box, or select Upload to add a .txt, .log, .md, .csv or .json file.
Select the flag buttons the pattern needs, like g for every match, i to ignore case or m for multiline. The Flags field takes typed letters too, and g is on by default.
Select Execute Regex Test in the online regex tester. The Match Results box lists every match with its index and capture groups, up to 50 on screen. Edit the pattern and run again, or select Clear All to start over.
Testing a regex means running a pattern against text and listing what it matches. The online regex tester shows the result as numbered match cards.
Select Execute Regex Test and the Match Results box lists every match as its own card, numbered from one, with the index where it starts. A badge shows the count, like 3 matches found.
The online regex tester has flag buttons that toggle g for global, i for ignore case, m for multiline, s for dotAll, u for unicode and y for sticky. The Flags field takes typed letters too, and g is on by default.
Every match card lists its capture groups as $1, $2 and so on, in order. The online regex tester shows values only, so a group name is not displayed.
The list shows the first 50 matches and says so when more exist. A truncated tag can appear beside the count. A bad pattern returns an error message in the panel.
To test a regex, check a regular expression and debug a pattern all name one job, and a search for online regex tester or test regex online lands on the tool above.
A regex is a pattern run against text. The cases below show what the tool lists, what it leaves out and where results can differ.
| The case | Result | What happens and why |
|---|---|---|
| Flags | g i m s u y | Global, ignore case, multiline, dotAll, unicode and sticky. A d flag for match indices has no button. For how unicode text is stored, see Character encoding explained and why text arrives broken. |
| Capture groups | numbered | The online regex tester lists groups by number under every match, as $1, $2 and so on. |
| Group names | not shown | The cards list group values by number. A name given in the pattern is not displayed. |
| Lookaround | check it | Lookahead and lookbehind depend on the engine behind the tester. Run a sample before trusting a pattern that uses them. |
| Replace | not on this page | There is no replace mode in the online regex tester. Test the groups here, then run the $1 swap in an editor or in code. |
| Engine | JavaScript flags | Flag names follow JavaScript RegExp. Check a pattern in the target runtime before it ships. |
| Not PCRE | differs | PCRE features like possessive quantifiers or recursion may throw an error or match differently. |
| ReDoS | caution | A nested quantifier on untrusted input can backtrack and hang the match. |
| Run | on a click | Nothing runs while the pattern is typed. Select Execute Regex Test with a pattern and text or a file in place. |
| Match limit | 50 shown | The list stops at 50 matches and says when more exist. |
| Source file | .txt .log .md .csv .json | Select Upload to test a pattern against a file instead of pasted text. |
| Bad pattern | error message | An invalid pattern returns an error message instead of a match list. |
| 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. The online regex tester takes a pattern, a set of flags and sample text, then lists every match with its index and capture groups. The flags follow JavaScript, with g for every match, i to ignore case, m for multiline, s for dotAll, u for unicode and y for sticky. Two honest points matter most. The first is flavor. A pattern built for Perl, PHP or Python may lean on a feature like a possessive quantifier or recursion that JavaScript lacks, so test it before trusting it. The second is backtracking. A nested quantifier over hostile input can run away, the pattern behind a class of denial-of-service bug. This page runs one test per click, lists up to 50 matches and has no replace mode or sample library. The references below define the language and its flags, and one of them is a deeper debugger for other flavors.
Both test a regex. The trade is between a quick focused check and a deeper multi-flavor debugger.
| Point of comparison | This tool Online regex tester 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 flavor only | Several flavors to select |
| A token-by-token explainer | Matches and groups shown | Every token explained |
| A quick JavaScript test | Open and test at once | More panels to read |
A full debugger like regex101 wins for switching flavors between PCRE, Python and Go, and it can explain a dense pattern token by token. The online regex tester wins for a quick JavaScript check with a plain match list and no clutter. Online file tools and whether yours uploads goes deeper on where a file goes.
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.
All of these test a regex. They vary in reach, in flavor and in setup.
regex101, grep and a code console all test a regex, yet every one means another flavor, the terminal or a script. The online regex tester above takes a pattern and sample text with nothing to install.
Keep these in mind and the results make more sense.
The flag names are JavaScript's: g, i, m, s, u and y. A pattern written for PCRE, Perl or Python may use a feature JavaScript lacks, like a possessive quantifier or recursion. It may throw an error or match differently. Port the pattern to JavaScript syntax first, then run it again.
The g flag is on by default in the online regex tester. Without it a pattern finds only the first match, which surprises many. Keep g on to list every match, and add i, m or s when case, line boundaries or a dot across newlines matter.
A backtracking engine can hang when a nested quantifier meets hostile input, the pattern behind a denial-of-service bug. Keep a pattern tight on untrusted input, and anchor it rather than leaving it open.
The online regex tester checks one pattern against one sample per run, which suits building and debugging. A multi-gigabyte log, an entire codebase or a pattern inside a build belongs on grep, ripgrep or a script that runs 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.
No sign-up needed. Enter a pattern and sample text in the online regex tester, then select Execute Regex Test.