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.

Flags
Try:

Matches

    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 text never leaves the browser. There is no server: 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.

    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.

    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 page works the same if you go offline after loading it.

    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, and zero runtime dependencies.