piapia123
en

Regex Tester

Text

Everything runs locally in your browser — nothing is uploaded

TEST TEXT
MATCHES
CAPTURE GROUPS
REPLACE PREVIEW

COMMON PATTERNS

Matching and replacing happen locally in your browser — neither the pattern nor the text is uploaded.

Build a regular expression in the browser: matches highlight as you type, capture groups including named ones are listed one by one, and entering a replacement previews the whole text rewritten. The tool also guards against catastrophic backtracking — a pattern such as (a+)+ can lock a browser tab for seconds on long input, so it is detected up front, refused on long text, and the reason is spelled out instead of pretending the scan finished.

Features

  • Live highlighting of every match, with zero-width matches such as \b and (?=x) marked in place
  • Capture group table showing group number, name and value; groups that did not participate are left visibly empty
  • Replace preview supporting $1, $& and $<name>, always previewed globally
  • Individual g / i / m / s / u flag toggles that behave exactly like the JavaScript engine
  • ReDoS guard: nested quantifiers and quantified alternations stop execution on long input with an explanation
  • Honest limits: input past 100,000 characters, more than 2,000 matches or a scan over 120 ms are all reported
  • A cheat sheet of common patterns (email, URL, IPv4, dates, times, CJK, phone numbers, colours, tags) that fills in along with sample text

How to use

  1. Type your pattern between the slashes and tick the flags you need
  2. Paste test text on the left — matches highlight as you type
  3. Enter a replacement string to preview the rewritten text below
  4. Click a cheat sheet entry to load it and see it work immediately

FAQ

Why did my pattern return nothing?
If the text is long and the pattern contains nested quantifiers such as (a+)+ or (\d+\s?)*, the tool stops and tells you. Those patterns backtrack exponentially on long input and would freeze the tab for seconds. Verify with short text first, or rewrite the pattern without nesting.
Why does it say the global flag is off?
Without g, JavaScript returns only the first match. That is the engine behaving normally, and the tool reports it rather than quietly adding g — otherwise a pattern that works here would behave differently once pasted into your code.
Is long input truncated?
Yes. Past 100,000 characters only the first part is scanned, and the page says so plainly. A synchronous regex cannot be interrupted once it starts, so limiting the input size is the only reliable protection.
Is my pattern or text uploaded?
No. Matching and replacing run entirely in your browser, the page makes no network requests, and it keeps working offline.

Related tools