Skip to tool
Skip to tool
💻 Developer & Code
ECECH AppDeveloper workspace

Free Online Regex Tester with Live Match Highlighting

Matches highlight as you type, capture groups are listed per match, and a runaway pattern is stopped before it hangs your tab instead of after.

Test a JavaScript regular expression as you type. Paste sample text to see highlighted matches, numbered and named capture groups, and a replacement preview. Your pattern and sample are evaluated in an isolated browser worker.

/ /

Matching runs locally in a separate browser worker. Limit: 200,000 characters and the first 2,000 matches.

Test string

Matches, highlighted

Matches

0

Groups

0

Characters matched

0

Time

—

Patterns people actually need

Advertisement

How the calculation works

One pattern, taken apart (\w+) @ (\w+) \. (com|org|net) group 1 one or more word chars literal group 2 escaped dot a bare . means any character group 3 alternation The single most common bug a.b matches "axb", "a5b", "a b" a\.b matches only "a.b" An unescaped dot inside a domain, filename or IP address pattern is why it "works" on your test data and fails in production.

How to Use This Tool

A regular expression is easy to write and hard to be sure about. The gap between "it matched my three test strings" and "it is correct" is where most regex bugs live, and the only reliable way to close it is to watch the matches highlight against real data as you type.

Writing and testing

Type the pattern in the top field — without the surrounding slashes, which are shown for you. Flags go in the box after, or use the checkboxes. The test string below highlights every match live, and the panel underneath lists each match with its position and every capture group broken out separately.

Capture groups are the part worth paying attention to. A pattern that matches is only half the job; if you are extracting data you need the groups to land where you expect. The list shows group 1, group 2 and any named groups by name, per match, so a mistake is visible immediately rather than three functions later.

Greedy versus lazy, on <b>bold</b> and <i>italic</i> <.+> greedy <b>bold</b> and <i>italic</i> one match, swallowing everything between the first < and the last > <.+?> lazy <b>bold</b> and <i>italic</i> four matches, each stopping at the nearest closing bracket
Adding ? after a quantifier makes it lazy. This one character is the difference between four tags and one enormous match, and it is the second most common regex mistake.

Timeout for slow patterns

Nested quantifiers such as (a+)+b can trigger catastrophic backtracking (ReDoS) on a near-match. This page runs matching and replacement in a separate browser worker. If the entire evaluation has not finished within 800 milliseconds, the page terminates that worker instead of blocking the interface.

The worker protects this preview, not another service that later uses the pattern. Before production use, test representative and adversarial inputs in the target engine and apply that runtime’s own limits.

Replace preview

The bottom field previews a replacement across the whole test string. Use $1, $2 for capture groups and $& for the whole match. Getting a replacement right in a preview takes seconds; getting it wrong in a script that has already rewritten four hundred files takes considerably longer.

JavaScript regex flavor and other languages

This tester uses the JavaScript regular expression engine provided by the current browser. It does not emulate Python, C#, Java, .NET, PowerShell, PCRE or Go. Those runtimes can differ in syntax, flags, Unicode behavior and replacement tokens. Treat this result as a JavaScript check, then run the pattern in the engine where it will be used.

Advertisement

Frequently Asked Questions

How do I use this online regex tester?
Enter a JavaScript regular expression without slash delimiters, paste a test string, and choose flags such as global or ignore case. The page updates match highlights, capture groups and replacement output as you edit.
Does this tester run Python, C#, Java, .NET or PowerShell regular expressions?
No. This page uses the JavaScript regular expression engine in your browser. Regex syntax, flags and replacement tokens differ across Python, C#, Java, .NET, PowerShell and other engines, so check the pattern in the runtime where it will be used.
What do the g, i, m, s and u flags mean?
Global (g) finds every non-overlapping match; ignore case (i) compares letters without case; multiline (m) changes how line anchors work; dotAll (s) lets a dot match line breaks; and Unicode (u) enables Unicode-aware pattern behavior. The browser must support a flag for it to run.
How do I use capture groups in the replacement preview?
Use $1 for the first numbered capture, $2 for the second, and $<name> for a named group. Use $& for the complete match. The preview applies JavaScript replacement rules to the test string.
What happens if a regular expression runs too long?
Matching and replacement run in a separate browser worker. If the complete evaluation exceeds 800 milliseconds, this page terminates that worker and shows a timeout message so the interface remains responsive.
Does the timeout prove a regex is safe for production?
No. The timeout limits this page’s local preview only. Test performance in the target runtime with representative and adversarial input, and use that runtime’s protections before deploying patterns that process untrusted text.
Is my test text sent to a server?
The pattern, test string and replacement are evaluated by a same-origin Web Worker in your browser; this tool has no server-side calculation endpoint. The page still loads its normal site resources and analytics separately.
How much text can I test at once?
The live preview accepts up to 200,000 characters and displays up to the first 2,000 matches. If you reach either limit, reduce the sample or split it into smaller pieces.

Related tools in Developer & Code

Browse all Developer & Code tools
The desk where ecech. tools get written: a laptop, a notebook of to-dos and a whiteboard listing the tools on the site.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.