Skip to content

Tools

Regex Checker

Type a pattern, paste some text, and watch every match light up live — capture groups, named groups and replace preview included. JavaScript flavour, runs entirely in your browser. Stuck? Describe the pattern in plain English and let the resident AI write it.

Flags
Try:

Matches

    Found a bug or a rough edge? Tell me — reports get fixed fast.

    What is this tool?

    A free regular-expression tester for the JavaScript flavour of regex — the one used by browsers, Node.js, Deno and Bun. As you type, your pattern is compiled with the browser's ownRegExp engine and run against the test text, so what you see here is exactly what your JavaScript code will do: same syntax, same flags, same quirks. Matches are highlighted live, every capture group (numbered and named) is listed per match, and the Replace tab previews String.replace() output with full template support.

    Your test text never leaves the browser. Matching runs client-side in a background worker, and the only thing stored is your last pattern and text, in your own browser's local storage, so it's still there when you come back. The one optional exception is the AI generator — off by default — which is this tool's twist:

    The AI twist

    Flip the AI generate switch and you can describe the pattern you need in plain English — "text inside double quotes", "times like 14:30", "words ending in -ing" — and a small language model writes the regex straight into the tester. The model is not a cloud API: it's a compact open-weights model running on this website's own server — the same machine that paints for the palette generator and plays The Gatekeeper. Your description is the only thing sent — never your test text — and nothing about you is stored with it.

    The best part is what happens next: the generated pattern lands in the tester above, so it's instantly verified against your own test text. Small models write imperfect regexes sometimes — here that's not a leap of faith, because you see exactly what matches (and what doesn't) before you ship it. Because the hardware is a modest CPU, an answer takes a few seconds, and identical descriptions are answered from a cache. Want a different take? Just ask again.

    How to use it

    • Type a pattern between the two slashes — no need to escape /.
    • Toggle flags: g to find every match instead of just the first, i to ignore case, m for line-by-line anchors.
    • Paste your test text; matches highlight instantly and each one is broken down below with its capture groups.
    • Switch to Replace to preview substitutions — $1, $<name> and $& all work, then copy the result.
    • Stuck? Load one of the example presets (ISO date, email, IPv4…) and tweak it — or flip on AI generate and just describe what you want to match.

    Quick reference

    Character classes

    TokenMatches
    .any character except newline (add s to include it)
    \d / \Ddigit 0–9 / anything but a digit
    \w / \Wword character (letters, digits, _) / non-word
    \s / \Swhitespace (space, tab, newline…) / non-whitespace
    [abc]one of a, b, c
    [^abc]anything except a, b, c
    [a-z0-9]ranges: a through z, or 0 through 9
    \p{L}any Unicode letter (needs the u flag)

    Anchors & boundaries

    TokenMatches at
    ^ / $start / end of the text (of each line with m)
    \b / \Ba word boundary / not a word boundary

    Quantifiers

    TokenRepeats the previous item
    *0 or more times
    +1 or more times
    ?0 or 1 time
    {3} / {2,5} / {2,}exactly 3 / 2 to 5 / at least 2 times
    *? +? ??lazy versions — match as little as possible

    Quantifiers are greedy by default: <.+>grabs from the first < to the last>. Add ? to make them lazy —<.+?> stops at the first close.

    Groups & backreferences

    TokenMeaning
    (abc)capture group — grabs the matched text as $1, $2
    (?<name>abc)named capture group — reference it as $<name>
    (?:abc)non-capturing group — groups without capturing
    \1, \k<name>backreference — match the same text a group captured
    a|balternation — a or b

    Lookaround

    TokenAsserts (without consuming)
    (?=abc)lookahead — what follows is abc
    (?!abc)negative lookahead — what follows is not abc
    (?<=abc)lookbehind — what precedes is abc
    (?<!abc)negative lookbehind — what precedes is not abc

    Replacement templates

    TokenInserts
    $&the whole match
    $1, $2capture group by number
    $<name>named capture group
    $` / $'text before / after the match
    $$a literal dollar sign

    Common patterns, explained

    Each of these is loadable from the Try: chips above — here's how they work:

    • ISO date(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}): three named groups joined by literal hyphens. Named groups shine in replacements: $<day>/$<month>/$<year>reorders a date in one step.
    • Email[\w.+-]+@[\w-]+(?:\.[\w-]+)+: a pragmatic matcher for scanning text. A fullyRFC-5322-correct email regex is famously enormous — for signup forms, prefer a simple check plus a confirmation email.
    • IPv4 — repeats an octet group(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d) four times: alternation is how a regex expresses "a number from 0 to 255", since regex has no concept of numeric ranges.
    • UUID — fixed blocks of hex digits with literal hyphens, plus [1-8] and [89ab] where the version and variant bits live.
    • Trailing whitespace[ \t]+$ with flags gm: m makes $ match at every line end, so replacing with nothing cleans a whole file.

    JavaScript flavour notes

    • This tool tests JavaScript regex. Most syntax carries over to PCRE (PHP), Python's re, and Java, but not everything: JavaScript has no atomic groups, no possessive quantifiers, and no inline flag modifiers like(?i) — use the flag checkboxes instead.
    • Lookbehind ((?<=…), (?<!…)) and named groups are supported in all modern browsers and Node — fine to use today.
    • Without the u flag, . sees an emoji astwo code units. Turn on u for sane Unicode handling and \p{…} classes like\p{Letter}.
    • \d is ASCII-only in JavaScript (just 0–9), unlike some flavours where it can match other numbering systems.

    When a pattern "hangs": catastrophic backtracking

    Nested quantifiers over overlapping alternatives — the classic is(a+)+$ against a long run of a's with no final match — force the engine to try exponentially many ways to split the input before giving up. In production this is a real bug class (ReDoS — regular-expression denial of service). This tool runs your pattern in a background worker with a watchdog, so a runaway pattern gets cut off with an error instead of freezing the page. If you hit that error: remove nesting, make the inner quantifier more specific, or anchor the pattern so failures fail fast.

    FAQ

    Is it free? Yes — free, no sign-up, no limits.

    Is my text uploaded anywhere? No. Matching happens in your browser; the testing side of the page works the same if you go offline after loading it. The optional AI generator — only if you've switched it on — sends exactly one thing, the description you typed, to this site's own server, where a local model answers it. No third-party AI service ever sees it, and your test text is never sent.

    Can AI really write my regex? For the everyday patterns you'd otherwise google — quoted strings, times, number formats, cleanup passes — yes, and the result drops straight into the tester so you can see it work before trusting it. For genuinely gnarly patterns treat it as a first draft: it's a small model, and the highlighting will tell you honestly where it falls short.

    Why does only the first match highlight? Theg (global) flag is off — that's exactly howString.match behaves in code, so the tool mirrors it. Toggle g to see every match.

    Which regex flavour is this? JavaScript (ECMAScript), as implemented by your own browser. For PCRE- or Python-specific syntax, results can differ — see the flavour notes above.

    Built from scratch for this site in vanilla TypeScript — a pure, unit-tested matching core, a Web Worker so heavy patterns never freeze the page, zero runtime dependencies, and a self-hosted small language model on regex-writing duty.