← All tools

Regex Tester

Test a JavaScript regular expression with live highlights, groups, and replace.

g
FLAGS
03 // HIGHLIGHTS
Matches appear here as you type.
Test string with each match highlighted
04 // MATCHES

    Enter a pattern to start.

    Cheat sheet and sample patterns

    Load a sample

    Common tokens

    .
    Any character except line breaks (all with s)
    \d
    Digit 0–9
    \w
    Letter, digit, or underscore
    \s
    Whitespace
    [abc]
    One of a, b, or c
    [^abc]
    Anything except a, b, or c
    ^ $
    Start / end of input (of each line with m)
    \b
    Word boundary
    * + ?
    0 or more, 1 or more, optional
    {2,4}
    Between 2 and 4 times
    *? +?
    As few as possible
    (…)
    Numbered capture group
    (?<name>…)
    Named capture group
    (?:…)
    Group without capturing
    a|b
    a or b
    (?=…) (?!…)
    Followed by / not followed by
    (?<=…) (?<!…)
    Preceded by / not preceded by
    \p{…}
    Unicode property, such as Script=Han (u or v)

    Replacement tokens

    $1
    Numbered group
    $<name>
    Named group
    $&
    Whole match
    $`
    Text before the match
    $'
    Text after the match
    $$
    A literal $

    Uses your browser's JavaScript RegExp engine. Ranges are UTF-16 offsets, the same as String.slice. Matching runs in the background, stops after 1 second, and lists up to 1,000 matches. The page URL updates as you type so you can share the test.

    Your inputs stay in this browser. These tools do not upload your text or colors.

    CAT SETTINGS
    HIDDEN SIGNAL

    Some familiar corners may glitch into something unexpected.

    Signal idle--
    PIXEL DETAIL

    Applied to every cat portrait.