Regex Tester

Write a regular expression and see every match highlighted in your text as you type. Check capture groups and named groups in a table, and try replacements with $1 and $<name>. Uses JavaScript regex syntax.

Pattern and text

Flags

Use $1, $2 for groups, $<name> for named groups and $& for the whole match.

Matches

    How to use the Regex Tester

    1. Type your pattern and choose flags such as g and i.
    2. Paste the text you want to test.
    3. Check the highlighted matches and groups, and try a replacement if you need one.

    Your data stays on your device. This tool runs entirely in your browser. Nothing you type or paste is sent to our server or saved. Read our privacy policy.

    Regex basics

    PatternMatches
    \dAny digit 0–9
    \wLetter, digit or underscore
    \sSpace, tab or line break
    .Any character except a line break
    + / * / ?One or more / zero or more / optional
    {3}Exactly three times
    ^ / $Start / end of the text (or line with m)
    ( )Capture group
    [abc]Any one of a, b or c

    Useful patterns

    • Pakistani mobile number: ^03\d{2}-?\d{7}$
    • CNIC number: ^\d{5}-\d{7}-\d$
    • Simple email check: ^[^\s@]+@[^\s@]+\.[^\s@]+$
    • Date as YYYY-MM-DD: ^\d{4}-\d{2}-\d{2}$

    Flags

    g finds every match instead of the first, i ignores upper and lower case, m makes ^ and $ work per line, s lets . match line breaks and u enables full Unicode.

    Replacements

    In the replacement box, $1 inserts the first group, $<name> a named group and $& the whole match. For example, pattern (\d{4})-(\d{2})-(\d{2}) with replacement $3/$2/$1 turns 2026-10-28 into 28/10/2026.

    This tester uses JavaScript regex. Python, PHP and Java are very similar but differ in some advanced features.

    Frequently asked questions

    Which regex syntax does it use?

    JavaScript (ECMAScript) syntax, as used in browsers and Node.js. Most patterns also work in PHP, Python and Java, but some features, such as lookbehind or named groups, differ between languages.

    What do the flags mean?

    g finds all matches instead of the first, i ignores upper and lower case, m makes ^ and $ match at every line, s lets . match line breaks, and u turns on full Unicode support.

    Why was my pattern stopped?

    Some patterns, such as (a+)+, can take an extremely long time on certain text. The tester stops any pattern that runs for more than two seconds so your browser doesn’t freeze.