Regex Tester

Test JavaScript regular expressions against your own sample text, with matches highlighted and capture groups broken out — all in your browser.

Common Patterns:

Matches

No matches found.

Built on the Real JavaScript Engine

This tool runs your pattern through an actual JavaScript RegExp object — the same engine your code uses — so results here match what you'll see in production.

Instant Match Highlighting

Click Test and every match in your sample text is highlighted inline, so you can see exactly what your pattern is (and isn't) catching.

Full Match List

With the global flag on, every match in the text is captured and counted — not just the first one — so you can confirm coverage across a whole document.

All Six Flags Supported

Toggle g, i, m, s, u, and y independently and see how each one changes what matches — the fastest way to understand what a flag actually does.

Regex Flags Reference

Flag
Name
What It Does
g
Global
Finds every match in the string instead of stopping after the first one.
i
Case-insensitive
Matches letters regardless of upper or lower case.
m
Multiline
Makes ^ and $ match the start/end of each line, not just the start/end of the whole string.
s
Dot-all
Lets . also match newline characters, which it skips by default.
u
Unicode
Treats the pattern and string as full Unicode code points — needed for correct matching of emoji and non-Latin scripts.
y
Sticky
Matches only starting from the exact current position (lastIndex), rather than searching forward through the string.

Common Regex Patterns

Password (8+ chars, upper/lower/number/symbol)
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/
URL (http/https)
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}/
Email address
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/i

Common Regex Mistakes

Seeing the wrong pattern next to the fix usually clicks faster than a description on its own.

Only the first match is returned

Wrong

/foo/

Fixed

/foo/g

Without the global flag, match() and matchAll() stop after the first hit.

Special characters not matching literally

Wrong

/$5.00/

Fixed

/\$5\.00/

$ and . are metacharacters — escape them with a backslash to match them as plain text.

Greedy quantifiers matching too much

Wrong

/<.*>/

Fixed

/<.*?>/

Adding ? after * or + makes the quantifier lazy, matching the shortest string instead of the longest.

Pattern hangs on long input

Wrong

/(a+)+b/

Fixed

/a+b/

Nested quantifiers like (a+)+ can cause catastrophic backtracking. Flatten nested repetition where the outer group adds nothing.

Frequently Asked Questions

Does this test regex the same way JavaScript runs it in production?

Yes — this tool builds a real RegExp object using JavaScript's own engine (the same one your browser or Node.js uses), so what matches here is exactly what will match in your code.

Will a pattern that works here also work in Python, PCRE, or another language?

Mostly, but not always. Core syntax like character classes, quantifiers, and basic groups is shared across most regex flavors. Features like named capture groups, lookbehind support, and Unicode property escapes can differ between JavaScript, Python's re module, and PCRE — always retest a pattern in its target language before relying on it in production.

Why does my pattern only match the first occurrence?

Without the global (g) flag, JavaScript's matchAll and related methods only return the first match in the string. If you expect multiple matches and only see one, check that the 'g' flag is checked.

Why do I need to escape characters like . or ( in my pattern?

Characters like . * + ? ( ) [ ] { } | ^ $ and \ have special meaning in regex. To match them literally, escape them with a backslash — for example, use \. to match an actual period instead of "any character."

Is my test text or pattern sent anywhere?

No. Matching runs entirely in your browser using JavaScript's built-in RegExp engine — nothing is uploaded or logged.

Explore Utility Applications

About This Utility

This tool is provided completely free of charge by Mavertex. Built by Kumar (an independent UI developer), our platform ensures your privacy by executing all operations strictly within your local browser DOM.

We prioritize zero-trust architecture. No files or inputs are ever uploaded to remote servers. This page serves as both an interactive web application and an educational resource explaining the mechanics of client-side operations. For further details on transparency and third-party network usage (including AdSense), please review our Privacy Policy.