Skip to tool

Free · no account · browser only

Regex Tester

Test a JavaScript regex against your text. Matches, groups and replace update as you type, and a slow pattern stops instead of freezing your tab.

Runs on the JavaScript regex engine built into your browser.

  • Colored groupsEach capture group gets its own color, and named groups show in the match table.
  • Stops slow patternsA pattern that runs past 250 ms is stopped, so your tab keeps working.
  • Explains your patternA plain breakdown of every token, made in your browser without AI.

Flags

  • Find every match, not just the first.

  • A matches a.

  • ^ and $ match at the start and end of each line.

  • The dot also matches line breaks.

  • Reads the pattern as full Unicode characters.

  • Matches only where the last match ended.

  • Records where each group starts and ends.

  • Adds set operations inside classes. Needs a recent browser.

Uses the JavaScript (ECMAScript) engine built into your browser. PCRE and Python syntax can differ.

The link holds the pattern, flags and replacement. Turn on Include test text to add your text too.

Results

No matches

#MatchIndexLengthGroupsNamed groups

Split by this pattern

Shows the parts you get from text.split() with this pattern.

    /regex-tester

    How it works

    How to test a regex in four steps.

    1. 1

      Type a pattern and turn flags on or off.

    2. 2

      Paste test text to see each match and its groups in color.

    3. 3

      Open Replace to preview the result with $1, $<name> or $&.

    4. 4

      Open Explain or Cheat sheet to understand or build a pattern.

    Frequently Asked Questions

    Answers about flags, groups, replace and regex flavors.

    What flags are supported?

    All eight JavaScript flags. g finds every match, i ignores case, m makes ^ and $ work per line, s lets the dot match line breaks, u turns on Unicode, y matches only at the current position, d records group positions, and v adds Unicode sets in recent browsers.

    How are matches highlighted?

    Each match is highlighted and each capture group gets its own color. The Matches tab lists every match with its index, length, numbered groups and named groups.

    What is the Replace field for?

    Type a replacement in the Replace tab to preview what String.replace() returns. Use $1 or $2 for numbered groups, $<name> for named groups and $& for the whole match.

    How can I test if a pattern is valid?

    Invalid patterns show the browser's error message right away. A pattern that runs too long is stopped after 250 ms, so the tab keeps working.

    Which regex flavor does this tester use?

    JavaScript, also called ECMAScript, the engine built into your browser. Most PCRE, PHP and Python patterns work the same, but possessive quantifiers and atomic groups are not supported.