Regex Tester

Test regular expressions against text in real time

Enter a pattern and flags, then see every match highlighted in your text instantly — with a list of matches and capture groups, all in your browser.

Pattern
//g
Flags
Highlighted matches
Matches will be highlighted here as you type.

About the regex tester

A regular expression (regex) is a compact pattern language for searching, matching, and replacing text. This tester compiles your pattern against the sample text on every keystroke and highlights every match inline, so you can fine-tune a pattern and see the result immediately.

When the global (g) flag is on, all matches are found; without it, only the first match is returned. Capture groups are listed beneath each match so you can inspect what each parenthesized group captured.

Flags

  • g — find all matches, not just the first.
  • i — case-insensitive matching.
  • m — ^ and $ match line beginnings and ends.
  • s — dot (.) matches newlines too.
  • u — treat the pattern as Unicode.
  • y — sticky matching at the current position.

How to use the regex tester

  1. Enter your pattern

    Type a regular expression in the pattern field — no leading or trailing slashes needed.

  2. Toggle flags

    Switch on the flags you need, such as g for all matches or i for case-insensitive.

  3. Add test text & read matches

    Paste the text to test against. Matches highlight live and a list of matches and groups appears below.

Frequently asked questions

Do I need to wrap my pattern in slashes?
No. Enter the raw pattern only — the tool adds the delimiters for you. Just type something like \d+ or [a-z]+.
What are capture groups?
Parenthesized parts of your pattern, like (\d+)-(\d+), capture the text they matched. Each match lists its groups so you can see exactly what was captured.
Why is only one match highlighted?
Without the global (g) flag, a regex stops at the first match. Turn on the g flag to find and highlight every match in the text.
What does an invalid pattern error mean?
Your pattern could not be compiled — usually because of an unbalanced parenthesis, stray quantifier, or bad escape. The exact error is shown so you can fix it.
Is my text sent to a server?
No. All regex compilation and matching runs entirely in your browser, so your text never leaves your device.

Other utilities