Regex Tester

Test a regular expression against your text live — see every match highlighted and counted — right in your browser. It uses the JavaScript regex engine, not PCRE.

Developer ToolsTrending Free No upload Instant

Loading Regex Tester…

Your browser is preparing the tool. It runs 100% locally.

Quick Answer

Enter a regular expression, choose flags, and type a test string — the tool highlights every match and shows how many there are, updating as you type. An invalid pattern shows the error. It uses the browser's JavaScript (ECMAScript) regex engine, so most patterns behave as expected, but advanced syntax can differ from PCRE, Python or .NET. Everything runs in your browser; nothing is uploaded.

What the Regex Tester Does

This tool lets you build and check a regular expression interactively. You type the pattern and flags and a sample of text, and it marks every part of the text the pattern matches, with a running count of matches.

It is the quick way to develop a regex — to confirm it catches what you intend and nothing more — without dropping it into code and running it. Live highlighting makes it obvious where the pattern hits and misses.

How It Works

The tool compiles your pattern and flags into a regular expression using the browser's built-in engine, then runs it against the test string. Each match is wrapped in a highlight, and the total is counted. If the pattern is not valid, the engine's error message is shown instead.

Because it uses the browser, the flavour is ECMAScript — the same regex your JavaScript code would run. Flags control behaviour: g matches all occurrences, i ignores case, m makes the anchors work per line, s lets the dot match newlines, u enables full Unicode, and y anchors matching to a position.

What it checks & how

  1. Read pattern and flags. Take the regular expression and the flags you enter.
  2. Compile the regex. Build it with the browser's engine, showing any error if it is invalid.
  3. Match the test string. Run the pattern against your text and find every match.
  4. Highlight and count. Mark each match in the text and show the total number.

What the flags do

g match all occurrences (not just the first) i ignore case m ^ and $ match per line s dot matches newlines u full Unicode y sticky (match at a fixed position)
Worked example
pattern \b\w+@\w+\.\w+\b on text with two email addresses → 2 matches highlighted

This is the ECMAScript flavour. A pattern that works here matches the same way in JavaScript, but may differ in PCRE, Python or .NET if it uses advanced features.

Privacy

Your pattern and test text stay on your device. The matching runs in your browser with no network request, so nothing is uploaded.

Because the work is local, you can test a pattern against real log lines or sample data without it being stored or sent anywhere.

Nothing persists between sessions — close the tab and the pattern and text are gone.

Standards & references

  • ECMAScript regular expressions — The JavaScript regex flavour, defined in the ECMAScript standard. This tool uses the browser's engine, so its behaviour matches what your JavaScript code will do.
  • Flavour differences — Most basic patterns behave the same everywhere, but advanced syntax differs. JavaScript uses (?) for named groups (not the PCRE (?P)), supports only fixed-width lookbehind, and lacks PCRE features like possessive quantifiers and recursion.
  • Flags — g (global), i (ignore case), m (multiline anchors), s (dot matches newline), u (Unicode) and y (sticky) change how the pattern is applied. The right flags are often as important as the pattern itself.

Accuracy & Limitations

The matching is exactly what the browser's regex engine does, so what you see here is what your JavaScript code will produce — there is no approximation in the matching itself.

The flavour is ECMAScript, not PCRE. If your pattern targets PHP, Python, .NET or a database, test it there too: named groups, lookbehind width, and several advanced constructs differ, and a pattern that works here can behave differently elsewhere.

Without the global flag, a regex matches only the first occurrence in code, though this tool highlights all of them for visibility. Keep the g flag in mind when you copy the pattern into your own code, where it changes how methods like match behave.

A complex or poorly written pattern can be slow on large inputs, and certain patterns can backtrack badly (catastrophic backtracking). The tool runs in your browser, so an extreme pattern on a big string may briefly hang the tab.

Real-World Use Cases

Building a pattern

Develop and refine a regex with instant visual feedback.

Debugging a match

See exactly what a pattern catches and what it misses.

Validating input formats

Check a pattern for emails, codes or IDs against samples.

Learning regex

Experiment with syntax and flags and watch the effect live.

When to use it — and when not to

Good for

  • Building and testing a JavaScript regex
  • Live match highlighting and counting
  • Checking a pattern against sample text
  • Learning regular-expression syntax

Not the best choice for

  • Patterns targeting PCRE, Python or .NET only
  • Relying on PCRE-only features (recursion, etc.)
  • Extremely large inputs or risky patterns
  • Replacing or transforming text (this only matches)

If your regex runs in PHP, Python or .NET, test it in that engine too, since advanced syntax differs. For find-and-replace rather than just matching, use a tool or editor with a replace field. For very large inputs, run the pattern in your code with proper safeguards.

Frequently Asked Questions

Which regex flavour does this use?
The JavaScript (ECMAScript) flavour, via the browser's built-in engine. So a pattern that matches here will match the same way in your JavaScript code.
Will my pattern work the same in Python or PHP?
Basic patterns usually do, but advanced syntax differs. Named groups, lookbehind width and several constructs are not identical across ECMAScript, PCRE and Python, so test in the engine your code actually runs.
What do the flags mean?
g matches all occurrences, i ignores case, m makes the anchors match per line, s lets the dot match newlines, u enables full Unicode, and y makes matching sticky to a position. They change how the pattern is applied.
Why does it highlight all matches without the g flag?
For visibility, the tool shows every match. In code, though, a regex without the global flag matches only the first occurrence, so remember to add g when you copy the pattern if you need all matches.
What happens if my pattern is invalid?
The engine's error message is shown instead of matches. That tells you what is wrong — an unbalanced bracket, an invalid escape, or a bad flag — so you can fix it.
Does it support named capture groups?
Yes, in the JavaScript form using angle-bracket names after a question mark. Note that this differs from the PCRE syntax, so a pattern copied from a PHP example may need adjusting.
Can it do lookbehind?
Yes, fixed-width lookbehind, as JavaScript supports. It does not support the variable-width lookbehind that PCRE allows, so a PCRE pattern relying on that will not work here.
Is my test text uploaded?
No. The matching runs entirely in your browser. Nothing is sent to a server, so you can safely test against real sample data.
Why is my pattern slow or hanging the page?
Some patterns backtrack heavily on certain inputs — called catastrophic backtracking — which can make matching very slow. Simplify the pattern or anchor it more tightly, and avoid running risky patterns on very large text.
Does this replace text or just match it?
It only matches and highlights. For find-and-replace, use a tool or editor that has a replacement field, where you can apply the pattern to transform the text.
What is the difference between match and test?
In code, test returns true or false for whether the pattern matches at all, while match returns the matched text. This tool effectively shows the matches, like a global match with highlighting.
Can I use Unicode property escapes?
With the u flag, JavaScript supports Unicode property escapes. Enable u in the flags and you can match by Unicode category, the same as your JavaScript code would with that flag.

References

Runs your pattern with the browser's JavaScript (ECMAScript) regex engine and highlights matches as you type; honest that advanced syntax differs from PCRE, Python and other flavours.

PopularHot

JSON Formatter

JSON Formatter for developers — instant, offline-style and privacy-safe.

DeveloperOpen Tool
Popular

JSON Validator

JSON Validator for developers — instant, offline-style and privacy-safe.

DeveloperOpen Tool
Popular

Base64 Encoder

Base64 Encoder for developers — instant, offline-style and privacy-safe.

DeveloperOpen Tool
Popular

Hash Generator

Fast, free Hash Generator that runs entirely client-side in your browser.

DeveloperOpen Tool
Popular

UUID Generator

Fast, free UUID Generator that runs entirely client-side in your browser.

DeveloperOpen Tool
Trending

CSS Minifier

Fast, free CSS Minifier that runs entirely client-side in your browser.

DeveloperOpen Tool

Ready to try the Regex Tester?

It is free, private and runs entirely in your browser — no sign-up, no uploads, no limits.