Skip to content

$ test | match | patterns

Regex Tester

Test regular expressions against sample text.

FLAGS:
COMMON PATTERNS:
MATCHES:0 matches found

How to test a regular expression

  1. [01]

    Type or paste a sample string into the TEST STRING box.

  2. [02]

    Enter a pattern in the REGEX PATTERN box, or click a COMMON PATTERNS button to insert one.

  3. [03]

    Tick the flags you need: g (all matches), i (ignore case), m (multiline), s (dotAll) and u (unicode).

  4. [04]

    Read the MATCHES panel: the match count, every match value with its start index, and the CAPTURE GROUPS panel below when the pattern uses parentheses.

Features

Live matching

Results recompute as you type. There is no run button to press, so you can watch a pattern tighten or loosen in real time.

Matches and groups

Every match is listed with its value and start index, and any capture groups appear in a separate panel, so you can verify both where a match landed and the parts it extracted.

Common patterns

One click drops a ready-made pattern for email, URL, phone, IP address or date into the box, handy as a starting point you then adjust.

Why test a regex locally

Regular expressions are dense and unforgiving: a single character can change what a pattern matches by a wide margin. Running it against a few sample strings in the browser lets you confirm the spans and the captured groups before the pattern goes into validation, a log filter or a find-and-replace. Because the text never leaves the page, you can safely paste realistic samples that might contain personal or internal data.

Flags explained

  • >g — global — Find every match instead of stopping at the first. The match count and capture-group list only show all matches when this is on.
  • >i — ignore case — Letters match regardless of upper or lower case, so "abc" also matches "ABC".
  • >m — multiline — ^ and $ match the start and end of each line, not just the whole string.
  • >s — dotAll — The dot . also matches newline characters, which it normally skips.
  • >u — unicode — Treats the pattern as Unicode, so astral characters and property escapes behave as expected.

Example

IN

Pattern \b\d{4}-\d{2}-\d{2}\b · g flag · "Born 1990-05-12, joined 2021-08-30"

OUT

2 matches: "1990-05-12" @ 5, "2021-08-30" @ 22

With the global flag the tool counts and lists every match; without it, only the first match is shown.

Frequently asked questions

Is my text uploaded anywhere?

No. The pattern and the test string are processed in your browser with the built-in RegExp engine. Nothing is sent to a server.

Which flags are supported?

g (global), i (ignore case), m (multiline), s (dotAll) and u (unicode). The y (sticky) flag is not offered, since it is less common for interactive testing.

Why does the match count change with the g flag?

Without g, the engine stops at the first match, so the count is at most one. With g it reports and lists every non-overlapping match.

What are the capture groups?

Parts of a pattern wrapped in parentheses are capture groups. Each match lists its groups in order in the CAPTURE GROUPS panel; a group that did not take part in the match is skipped.

What happens with an invalid pattern?

The tool shows the engine error next to the results and keeps your test text visible, so you can fix the pattern and watch it update.

Related tools