Flags
g

Test string

Matches

Replace with

Replace result

Answer "does this regex actually match what I want?" without running any code — right in your browser. Type your pattern at the top and paste your test string below, and matches are highlighted in real time with a live count of how many were found. Capture groups `(...)` and named groups `(?<name>...)` are listed for each match, numbered and named, so you can confirm you're extracting exactly the right part. Toggle the g (global), i (ignore case), m (multiline), s (dotall), u (unicode) and y (sticky) flags with checkboxes — the change applies instantly and shows up in the trailing `/flags` display. Enter a replacement string to preview the result using replacement patterns like `$1`, `$<name>` and `$&`, then copy it with one click. The engine is the browser's built-in JavaScript (ECMAScript) regular expressions, so the behaviour matches what you'll get in front-end and Node.js code. Because you often test against logs, config or personal data, this tool runs all matching, extraction and replacing entirely inside your browser — nothing is uploaded, stored or sent to a server.

How to use

  1. Type your regular expression in the pattern box (tick the g/i/m/s/u/y flags you need). Use "Sample" to try an example.
  2. Paste the text you want to test into the test-string box. Matches are highlighted and the count and groups appear instantly.
  3. Enter a replacement (e.g. `$1` or `$&`) to preview the result, and click "Copy" to grab it. Nothing you paste is sent anywhere.

FAQ

Is the pattern or text I enter uploaded anywhere?

No. Matching, group extraction and replacing all run in your browser with JavaScript. Your pattern and test string are never uploaded, stored, or sent to a server, so it's safe to test against logs, config files or text containing personal data.

Which regex engine (flavor) does it use?

The browser's built-in JavaScript (ECMAScript) regular expression engine. That means the behaviour matches front-end and Node.js code. It follows the ECMAScript spec for things like `\d`, `\w`, `(?<name>...)` and lookahead `(?=...)`, but note it differs from PCRE, Python's `re` or Java in some syntax (for example `\A`, recursion, or `\h` are not supported).

What do the g / i / m / s / u / y flags do?

g = global (don't stop at the first match — find them all), i = ignore case, m = multiline (^ and $ match at line breaks), s = dotall (. matches newlines), u = unicode mode, y = sticky (match only from lastIndex). Toggling a checkbox updates the result immediately and the `/flags` shown after the pattern. With g off, only the first match is considered.

Can I see capture and named groups?

Yes. Plain groups `(...)` are listed as 1, 2, 3…, and named groups like `(?<year>\d{4})` are listed by name, for every match. A group that didn't participate shows as `(undefined)`, and one that matched an empty string shows as `(empty)`, so you can see exactly what each group captured.

What replacement syntax can I use (like $1 or $<name>)?

The "Replace with" box uses the same replacement patterns as JavaScript's String.replace: `$1`–`$9` (numbered groups), `$<name>` (named groups), `$&` (the whole match), `` $` `` (text before), `$'` (text after) and `$$` (a literal dollar sign). With the g flag set, every match is replaced; without it, only the first.

Can it get stuck on huge match counts or loop forever?

Zero-length matches still advance by one position to avoid an infinite loop, and the number of matches shown is capped (at 5,000) before stopping — when the cap is hit it shows "showing first N". Everything runs locally, so an extremely heavy pattern may briefly freeze the tab, but your data is never sent anywhere.