Skip to content
Dev

Regex Tester

This regex tester runs a JavaScript regular expression against sample text and lists matches and capture groups.

JavaScript source, without surrounding slashes. Example: (\\w+)@(\\w+\\.\\w+)

Flags

Common JS flags: g, i, m, s, u, y. Matching uses this browser’s RegExp, not PCRE or .NET.

The haystack. Matches update as you type and stay on this device.

Matches

2 matches · flags g.

Highlight

Ada <ada@example.com> and Lin <lin@tools.dev>
Order 1042 is not an email.

Capture groups

  1. Match 1

    ada@example.com

    Index 5 · length 15

    Group 1
    ada
    Group 2
    example.com
  2. Match 2

    lin@tools.dev

    Index 31 · length 13

    Group 1
    lin
    Group 2
    tools.dev

How to use

  1. Enter a pattern without slashes, or paste a /pattern/flags literal if the field accepts it.
  2. Set flags such as g, i, m, s, or u.
  3. Paste the sample text and read highlighted matches. The pattern stays in your browser.

How it works

The page compiles the pattern with the browser’s RegExp engine (ECMAScript), not PCRE or .NET. Global (g) finds every match. Invalid syntax shows the engine’s error instead of a match list.

Example. The pattern \d+ with the g flag on “Order 12 and 4” matches 12 and 4. A missing parenthesis is reported as a syntax error.

Frequently asked questions

Which regex flavor is this?

JavaScript (ECMAScript) via your browser's RegExp. It is not PCRE, Python, or .NET.

Are my strings uploaded?

No. Matching runs locally. The pattern and sample text stay in your browser.

What flags can I use?

Common JS flags: g, i, m, s, u, y. Global finds every match, i ignores case, m lets ^ and $ match line edges, s lets a dot match a newline, u turns on Unicode mode, and y (sticky) matches only at the current index.

Why did my pattern error?

Invalid syntax throws a browser RegExp error. Check unescaped slashes or unfinished groups. The message in Matches is the engine error itself.

Can I replace matches?

This version tests and lists matches. Substitution can be added later.