Free Online Regex Tester

Test a Regex Online

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

No upload Live matches Groups and flags Free
0
Bytes uploaded
7
Regex flags
0
Files stored
$0
Free, always
Why test a regex

Three Reasons to Test a Regex

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.

Build a Pattern by Eye

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 pattern shaped as it is typed.

Catch a Bug Before It Ships

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 checked before release.

Test on Real Data Privately

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.

A test without exposing the data.
How it works

Test a Regex in Three Steps

1

Add the Text and Pattern

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.

TEXT PATTERN flags
2

Set the Flags

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.

3 matches
3

Refine or Replace

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.

Live matches Groups and index
Replace With $1 and $2
One or a batch Download or ZIP
Need it faster?

Run a Pattern Across a Whole Log

A pattern against a page of text runs in one step on this page. For a multi-gigabyte log, a whole folder of files or a step inside a build, grep or ripgrep on the command line runs the same pattern straight from disk across the lot.

Get Desktop Version Free trial · Windows 7 to 11
What the free tool does

What the Regex Tester Does

To test a regex is to run a pattern against text and see what it matches. The tool does that on the device.

Live Match Highlighting

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.

All Seven Flags

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.

Capture Groups, Named Too

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 With $1 and $2

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.

Reference

What Converts Cleanly and What to Watch

A regex is a pattern run against text. These points decide how it behaves and where it differs.

The caseResultWhat happens and why
Flagsg i m s u y dGlobal, ignore case, multiline, dotAll, Unicode, sticky and match indices.
Capture groupsnumberedGroups 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 $2Substitution drops the captured groups into the output by number.
EngineECMAScriptThe native JavaScript RegExp, the same as new RegExp in any browser.
Not PCREdiffersPCRE features such as possessive quantifiers or recursion throw or differ.
ReDoScautionA nested quantifier on untrusted input can backtrack and hang the match.
Where it runson the deviceThe 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.

Honest comparison

This Tester vs a Full Debugger

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.

Why no upload

The Text Never Leaves the Device

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.

1. Open the browser tools at the Network tab
2. Clear the log and let it record
3. Test a pattern with the panel above
Nothing uploads. The pattern was run on the page itself.
0
Bytes uploaded
0
Files stored
0
Accounts required
0
Watermarks added
Alternatives

Other Ways to Test a Regex

Each of these tests a regex. They vary in reach, in flavour and in where the text goes.

regex101

regex101 switches flavours and explains a pattern token by token.
It covers PCRE, Python, Go and JavaScript.
It defaults to PCRE, so switch to JavaScript to match here.

grep or ripgrep

grep and ripgrep run a pattern over files and folders fast.
They suit a large log or a whole codebase.
They live in the terminal with their own regex dialect.

In Code

A RegExp object tests a pattern in a console or a script.
It fits straight into the program that will use it.
It shows no live highlighting as the pattern changes.

An Editor Find

The find box in an editor searches open files by regex.
It works right where the code is written.
Its dialect varies by editor and shows few group details.

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.

Before converting

Three Things to Know Before Converting

A little context saves a confused result.

This Is JavaScript Regex

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.

Add g for Every Match

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.

Watch for Runaway Backtracking

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 desktop edition

When a Pattern Runs Across Files

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.

In a browser taba page at a time
On the command linea whole tree in one pass
Across Files

Run a pattern over a folder or a codebase in one command, listing every file and line that matches at speed.

Huge Logs

A multi-gigabyte log is streamed from disk and searched, past what a browser tab holds in memory at once.

In a Script

A pattern runs inside a build or a hook, so a check or a bulk replace happens automatically, ready for a repeated workflow.

Common questions

Regex Tester Questions

It runs a regular expression against text and highlights every match in the browser, live as the pattern is typed. Each match lists its capture groups and position. The flags toggle with a click, and a replace mode shows the output.
No. The pattern is run by the browser's own RegExp engine, so the text never leaves the device. This matters, since a regex is often tested against a real log, a database dump or a sample with live records in it.
JavaScript, also called ECMAScript. It runs the native RegExp engine that every browser, Node and Deno share, so a pattern behaves here exactly as new RegExp would run it in code. It is not the PCRE flavour that Perl or PHP use.
The g flag finds every match rather than the first, i ignores case, m makes the anchors match at line boundaries, s lets a dot match a newline, u turns on full Unicode, y makes the pattern sticky and d reports the start and end index of each match.
A group in parentheses captures the part of the match inside it, numbered from one, with the full match at zero. A group can also be named with the (?...) form and read back by that name, which mirrors what an exec call returns in code.
Yes. Switch to replace mode and enter a replacement, using $1 and $2 to drop the captured groups into the output. The result shows straight away, which previews a find-and-replace before it is run over a file or in a program.
Because this is JavaScript regex, not PCRE. A pattern built for Perl, PHP or Python may use a possessive quantifier, an atomic group, recursion or an inline modifier that the ECMAScript engine does not support, so it throws or matches differently. Port it to the JavaScript form.
Yes. Lookahead and lookbehind both work, as do named capture groups and Unicode property escapes with the u flag, all added to JavaScript in recent editions. These are the features most patterns reach for beyond the basic tokens.
Because the g flag is off. Without g, a JavaScript regex returns only the first match. Toggle the g flag on to find every match in the text, which is also what the matchAll method needs in code.
It is when a pattern with a nested quantifier hits input that makes the engine try a huge number of paths, so the match hangs. Because JavaScript uses a backtracking engine, this is a real risk on untrusted input. It is the pattern behind a denial-of-service bug called ReDoS.
The error comes straight from the JavaScript RegExp constructor, the same message a browser console would show. The common causes are an unescaped special character, a group that is not closed or a flag combination JavaScript does not allow, such as the same flag twice.
Yes. A set of sample patterns covers common needs such as an email, a date, a URL, an HTML tag or a phone number. Loading one gives a working starting point that can be adjusted rather than a pattern built from nothing.
Yes. Drop a text file into the panel and the pattern runs against its contents on the device. A log, a config, a CSV or any text format works. The file is never sent to a server for the match.
Yes, for JavaScript. Since this runs the same ECMAScript engine as the browser and Node, a pattern that works here works the same in JavaScript code. For Python, Java or Go, the simple patterns usually carry across, but confirm any advanced feature in that language.
Yes. The tool runs in a mobile browser as well as on a desktop, so a pattern is tested on a phone without an app. The text is searched on the device and nothing is sent to a server.
The page is cheap to host, and since the work happens on the device nothing is received or kept here. The wider suite of tools is what supports the site. There is no cap, no watermark and no sign-up.

OnlinePCApps Developer Group

Written and reviewed by Milan Horvat, who has worked on text processing and developer tools here since 2013

Last reviewed August 2026
13
Years on dev tools
0
Patterns uploaded
7
Regex flags
0
Watermarks

The single most useful thing to know about a regex tester is which engine it runs, and here it is JavaScript, the ECMAScript RegExp that a browser and Node share. That is why a pattern tested here behaves the same in JavaScript code, and also why a pattern copied from a Perl or Python answer can fail, since PCRE has features such as possessive quantifiers and recursion that ECMAScript does not. The other thing worth stating plainly is the g flag, because a JavaScript regex without it returns only the first match, which trips up more people than any other detail. Live highlighting is what makes the tool quick, since a token added or a quantifier loosened shows its effect the moment it is typed. A word of caution belongs with a backtracking engine too, as a nested quantifier over hostile input can hang, the risk known as ReDoS. Since a pattern is usually tested against a real log or sample, the whole thing runs in the browser and sends nothing to a server.

Standards followed

RegExp · ECMAScript Flags · g i m s u y d Groups · Named ReDoS · OWASP
Built on the same shared design system as every OnlinePCApps tool. onlinepcapps.com

Test a Regex Online for Free

Free and online, with no sign-up and no upload. Test a regular expression in the browser, all on the device.

Test a Regex Free, no account Try Desktop Edition For logs and scripting
Test a Regex