Regex Tester

Test regular expressions against your own text and see every match highlighted as you type, along with its position and capture groups. Patterns use JavaScript regex syntax and run right in your browser.

Flags

Match details

Matches will be listed here.

    Why This Tool Matters

    Regular expressions are easy to write and hard to trust. A developer adding validation to a sign-up form needs to know the email or postcode pattern accepts every real value and rejects the junk — before it ships and starts turning away customers. Someone else is staring at a pattern that should match but doesn't, and can't tell whether the problem is an unescaped dot, a missing flag, or an anchor pinned to the wrong place. Seeing every match highlighted directly in the text, updating as you edit the pattern, turns that guesswork into a quick loop of change, look, and adjust.

    It's just as useful for pulling data out of text. Paste a chunk of a log file and build a pattern that captures timestamps, error codes, or order numbers, then check the match details to confirm each capture group holds exactly what you expect before you wire the pattern into a script. Matching runs in a background worker, so a pattern with runaway backtracking is stopped after a second with an explanation, instead of freezing the page.

    How to Use

    1. 01

      Enter a pattern

      Type your regex and tick the flags you need.

    2. 02

      Add test text

      Matches highlight live, with groups listed below.

    3. 03

      Copy the regex

      Copy it as a ready-to-paste JavaScript literal.

    More Text Tools

    Frequently Asked Questions

    Does this support all JavaScript regex features?

    Yes — patterns run on your browser's own JavaScript regex engine, so everything it supports works here: character classes, quantifiers (including lazy ones), anchors, backreferences, lookahead and lookbehind, named capture groups, and Unicode property escapes like \p{L} (tick the u flag for those). The g, i, m, s, and u flags are available as checkboxes; the sticky (y), indices (d), and v flags aren't exposed because they don't change what a tester like this shows.

    Why does my regex match differently here than in Python?

    Regex syntax varies between languages, and this tool uses JavaScript's flavor. Common differences: Python names groups with (?P<name>…) while JavaScript uses (?<name>…); Python's re.match only matches at the start of the string, whereas this tool searches anywhere, like re.search; Python accepts a leading inline flag such as (?i) and anchors like \A and \Z, which JavaScript doesn't; and \d and \w in Python 3 match Unicode digits and letters by default, while in JavaScript they're ASCII-only. Test here if the pattern will run in JavaScript — in a browser, Node.js, or an HTML pattern attribute.

    What do the g, i, m flags do?

    g (global) finds every match instead of stopping at the first. i (case-insensitive) makes "abc" match "ABC". m (multiline) makes ^ and $ match at the start and end of each line, not just the whole string. This tool also offers s (dotall), which lets . match line breaks, and u (unicode), which enables Unicode property escapes and treats emoji and other astral characters as single characters.

    Can I see capture groups from my match?

    Yes. The match details panel lists every match with its index and length, followed by each capture group's value — labeled $1, $2, and so on, with the name shown for named groups like (?<year>\d{4}). Groups that didn't take part in a match (for example, the unused side of an alternation) are shown as undefined rather than left out, so the numbering always lines up with your pattern.

    Is my regex or test string sent anywhere?

    No. Matching runs entirely in your browser, in a background worker on your own device. Nothing you type is uploaded, logged, or stored, so it's safe to test patterns against real log files, customer data, or anything else sensitive.

    Why is my regex not matching anything?

    The usual suspects: a case mismatch (tick i); ^ and $ anchoring to the whole string when you meant each line (tick m); . not crossing line breaks (tick s); or special characters that need escaping — a literal dot, plus sign, parenthesis, or question mark must be written as \., \+, \(, or \?. Also note that backslashes here are typed once, as in a regex literal: \d, not the \\d you'd write inside a JavaScript string. If the pattern is complex, try deleting parts from the end until something matches to find the piece that's failing.