Regex Tester

Type a pattern and matches light up in the test string instantly. Capture groups, replacement output and what each part of the pattern means are all on one screen — and patterns that would freeze your browser are stopped after one second.

On-device・No upload

Your files and input are processed only inside your browser on this device and are never uploaded to our servers.

g

Common patterns18

Click to load the pattern, flags and a sample text. Every pattern has limits — read the caveat.

Web & network

Japan-specific

Dates & validation

Text cleanup

Test string
258 chars5 lines
Results
Matching…
Pattern explained15
  1. (?<user>Start of named group “user” (#1)
  2. [\w.+-]One of: word char, “.”, “+”, “-”
  3. +Previous item, one or more times (as many as possible)
  4. )End of group
  5. @The character “@”
  6. (?<domain>Start of named group “domain” (#2)
  7. [\w-]One of: word char, “-”
  8. +Previous item, one or more times (as many as possible)
  9. (?:Start of a non-capturing group
  10. \.A literal “.” (escaped)
  11. [\w-]One of: word char, “-”
  12. +Previous item, one or more times (as many as possible)
  13. )End of group
  14. +Previous item, one or more times (as many as possible)
  15. )End of group

How to use

  1. Enter the pattern (the part between the slashes, e.g. \d{3}-\d{4}) and toggle flags such as g, i and m.

  2. Paste the text to search into “Test string”. Matches are highlighted in place, and the panel on the right lists each match’s index, length and groups.

  3. To replace, switch to “Replace” and enter a replacement using $1 or $<name>; the output shows exactly what changed.

  4. For validation patterns, use “Test cases”: list values that should and should not match, one per line, and see pass/fail for all of them.

  5. Copy the finished pattern as a “JS literal” or as “new RegExp()” and paste it into your code.

What it does

Live in-place highlighting

Matches are painted directly on the test string as you type. Adjacent matches alternate colours and zero-width matches show as a thin bar, so you see exactly where — and how often — the pattern hits. Pick a match in the list to select it in the text.

Numbered and named groups

Every match lists $1, $2… and named groups (?<name>…) with their values and positions. Groups that did not participate and empty strings are shown distinctly, which makes backreferences and replacements easy to build.

Replace preview with a change list

$1, $<name>, $&, $` and $' are expanded exactly as the JavaScript spec defines, and the output highlights what changed. A before → after list is included; copy or save the result.

Pass/fail test cases

Check a validation regex against “should match” and “should not match” lists in one go. Optionally require a whole-line match (wrapping in ^…$); a bar shows how many cases pass.

Pattern explained in plain language

Our own parser explains quantifiers, character classes, lookarounds, backreferences and Unicode properties one token at a time. Syntax errors point to the exact character and suggest a fix.

Built not to freeze your browser

Matching runs in a Web Worker and is terminated after one second. Classic catastrophic-backtracking shapes like (a+)+ are flagged up front with tips to fix them.

Use cases

  • Validate a form-validation regex (email, postal code, phone number) against good and bad examples
  • See how many matches a pattern finds in logs or CSV — and where — before extracting data
  • Preview a $1 / $<name> search-and-replace before running it in your editor or script
  • Decode a complex regex written by someone else, piece by piece
  • Safely reproduce whether a production hang was caused by a regex (ReDoS)

Supported formats

Syntax

JavaScript (ECMAScript 2025) RegExpFlags d, g, i, m, s, u, v, yNamed groups & backreferencesLookahead & lookbehindUnicode properties \p{…}

Copy as

JS literal /…/flagsnew RegExp("…", "flags")Replacement output (text file)Split result (JSON)

Capability matrix

FeatureSupportNotes
Match highlighting, positions & groupsSupportedUp to 10,000 matches listed; first 2,000 highlighted
Replace preview ($1, $<name>, $& …)SupportedIdentical to String.prototype.replace
Split and multi-line pass/fail testingSupported—
Pattern explanation & error positionPartialCommon syntax covered; v-flag set operations are shown as raw items
Catastrophic backtracking detectionPartial1-second hard stop plus warnings for classic shapes; not every dangerous pattern can be predicted
PCRE, Python, Java or .NET regex flavoursNot supportedRuns on the JavaScript engine; (?i), \A, possessive quantifiers etc. behave differently
Saving patterns or share linksNot supportedNothing you type is stored anywhere
Offline useSupportedWorks without a connection once loaded

Limits & notes

  • Test strings up to 1,000,000 characters; patterns up to 10,000 characters.
  • Up to 10,000 matches are counted and listed; the rest are cut off (replacement output is still computed in full).
  • Above 200,000 characters, in-place highlighting is turned off and only the list is shown.
  • Any single run longer than one second is stopped. Split very large inputs if a legitimate pattern is slow.
  • Available flags and syntax depend on your browser’s JavaScript engine (the v flag needs a recent browser).

Privacy & safety

Your pattern and test text are processed only inside your browser. Nothing is uploaded or stored, and analytics never include what you type — so it is safe to test against logs or customer data.

FAQ

How do I match Japanese or other non-Latin text?
Turn on the u flag and use Unicode properties such as \p{Script=Han} for kanji or \p{L} for any letter; ranges like [ぁ-ゖ] (hiragana) and [ァ-ヶー] (katakana) also work. Note that \d and \w only match ASCII digits and letters.
Is there a perfect email regex?
No. Fully implementing RFC 5322 is impractically complex, and no regex can tell whether an address exists. The library here uses the same pragmatic rule as the browser’s <input type="email"> and states its limits.
What is ReDoS / catastrophic backtracking?
Patterns with nested repetition such as (a+)+$ can try an exponential number of combinations on input that almost matches, freezing the program. This tool runs matching in a separate thread and stops it after one second, so you can reproduce the problem safely.
What is the difference between $1 and $<name> in a replacement?
$1 inserts the first parenthesised group; $<name> inserts the group declared as (?<name>…). Named groups keep working when you add more groups. $& is the whole match and $$ is a literal dollar sign.
What happens without the g flag?
Only the first match is found, and Replace changes only the first occurrence. Turn on g to target every match, and m if ^ and $ should apply to each line.
Can I test Python or PHP regular expressions?
Patterns are evaluated by your browser’s JavaScript engine. The basics are shared, but inline flags like (?i), \A / \Z and possessive quantifiers differ, so double-check in the target language.

Diff Tool — Text & Code Compare

Paste or drop two versions and see added and removed lines, plus the exact words that changed inside each line. Copy or save the result as a unified patch. Nothing leaves your browser.

UUID / ULID / NanoID / Token Generator

A UUID is ready the moment the page opens. Switch to UUID v7, ULID, NanoID or a random token, generate up to 10,000 at once and save them as .txt, .csv or .json. Paste an existing UUID or ULID to read its embedded time and version.

Code Formatter — Format & Minify

Paste code to format it with the language auto-detected. Choose indent, line width, semicolons, quotes and trailing commas; JavaScript, CSS and HTML can also be minified with before/after size and reduction. Your code never leaves the browser.

JSON Studio — Formatter & Validator

Paste JSON to format, minify or validate it instantly. Errors are shown with the exact line, column and cause, and comments or trailing commas can be auto-repaired. Your data never leaves your device.

XML Studio — Formatter & Validator

Paste XML to format, minify or validate it. Errors show the exact line, column and cause, and whitespace that carries meaning (mixed content, xml:space) is never touched. XPath search and JSON conversion are on the same screen. Your data never leaves your device.

YAML / TOML Studio — Validate, Format & Convert

Paste YAML, TOML or JSON to validate, format or convert it. Errors show the exact line and column, and type traps such as “no becomes false” and anything lost in conversion are flagged up front. Your data never leaves your device.

Last updated: