Regex Tester

Interactive regular expression tester and visualizer

/ / g
Presets:
0 matches
No matches

History

    Regex Reference

    Character Classes

    .Any char (except newline)
    \dDigit [0-9]
    \DNon-digit
    \wWord char [a-zA-Z0-9_]
    \WNon-word char
    \sWhitespace
    \SNon-whitespace
    [abc]Any of a, b, or c
    [^abc]Not a, b, or c
    [a-z]Range a through z

    Quantifiers

    *0 or more (greedy)
    +1 or more (greedy)
    ?0 or 1 (optional)
    {n}Exactly n times
    {n,}n or more times
    {n,m}Between n and m times
    *? +?Lazy versions

    Anchors & Boundaries

    ^Start of string/line
    $End of string/line
    \bWord boundary
    \BNon-word boundary

    Groups & Lookaround

    (abc)Capture group
    (?:abc)Non-capturing group
    (?<n>abc)Named group
    \1Backreference to group 1
    a|bAlternation (a or b)
    (?=abc)Positive lookahead
    (?!abc)Negative lookahead
    (?<=abc)Positive lookbehind
    (?<!abc)Negative lookbehind

    Escapes

    \.Escaped special char
    \n \r \tNewline, CR, tab
    \0Null character

    Replacement

    $1 $2Captured group
    $&Entire match
    $`Before match
    $'After match
    $$Literal $
    JavaScript RegExp engine