Toolpuffin

    Loading...

    Up and down to choose, Enter to open, Esc to close.

    Regex Cheat Sheet: Symbols and What They Mean

    Updated November 2026

    Written by the Toolpuffin team. Tools in this guide are tested in the browser.

    Regular expression symbols look like noise until you know what each one does. This cheat sheet lists the ones you will meet most, with a short example for each, so you can read a pattern or write your own.

    Try the tool: Regex Tester

    Characters

    SymbolMeaningExample
    .Any one character except a line breaka.c matches abc and a1c
    \dOne digit, 0 to 9\d\d matches 42
    \wOne letter, digit or underscore\w+ matches hello_1
    \sOne whitespace character: space, tab or line breaka\sb matches a b
    [abc]One of the characters inside the brackets[aeiou] matches any vowel
    [^abc]Any one character except those inside the brackets[^0-9] matches any non-digit
    \.A backslash makes a symbol literal\. matches a real dot

    Repeating

    SymbolMeaningExample
    *Zero or more of the thing before itab*c matches ac, abc and abbc
    +One or moreab+c matches abc and abbc, not ac
    ?Zero or one, so optionalcolou?r matches color and colour
    {n}Exactly n times\d{4} matches 2026
    {n,m}Between n and m times\d{2,4} matches 12, 123 and 1234

    Positions

    SymbolMeaningExample
    ^The start of the text, or of each line with the multiline flag^Hello matches Hello at the start
    $The end of the text, or of each line with the multiline flagend$ matches end at the end
    \bThe edge of a word\bcat\b matches cat but not concatenate

    Positions do not match a character. They match a place between characters.

    Groups and choices

    • (abc) groups characters together and remembers what it matched.
    • cat|dog matches cat or dog.
    • (?:abc) groups without remembering.
    • (cat|dog)s? matches cat, cats, dog and dogs.

    Flags

    • g finds all matches, not just the first.
    • i ignores upper and lower case.
    • m lets ^ and $ work on each line.
    • s lets the dot match line breaks too.
    • u turns on full Unicode support.

    The regex tester has a switch for each of these flags.

    Try a symbol

    1. Open the regex tester and paste some text.
    2. Type a pattern from the tables.
    3. Check which parts are highlighted, and change the pattern to see what moves.

    The tester uses the JavaScript flavour. Most symbols above work the same in other languages, but features such as lookbehind can differ.

    More guides