HelperCrate

Regex Tester

Test regular expressions live with match highlighting and replace preview.

Your files never leave your device. Everything runs in your browser.

What Regex Tester does

Regex Tester runs a JavaScript regular expression against sample text and shows every match highlighted in place. The pattern, flags, test text and an optional replacement are all editable, and the results update as you type.

It is built for the fiddly part of writing regular expressions: checking that a pattern matches the right things and that it does not match the wrong ones. Paste a log line, a list of email addresses, a snippet of HTML or test data, then refine the pattern and watch the highlights and match list change. A pattern such as “\b\w+@\w+\.\w+\b” over “Contact [email protected] or [email protected]” reports two matches, at indexes 8 and 27.

The match counter shows how many matches were found, each row in the match list shows the matched text, its starting index and any captured groups, and adding a replacement previews the substituted result. Everything runs on the browser's regular expression engine.

How to use Regex Tester

  1. Enter the pattern in the Pattern field and the text to search in Test text.
  2. Tick the flags you need: g (global, on by default), i (ignore case), m (multiline), s (dot matches newlines) and u (Unicode).
  3. Read the highlight — every match is marked in the text, or only the first without the g flag — and check the match count above it.
  4. The match list below shows each match's text, starting index and capture groups; the first 20 are listed while the counter shows the total.
  5. Type a replacement in Replace with to preview the result, using $1, $2 and $& in the same way JavaScript's replace does.
  6. Click Copy result to copy the replaced text — it works once a replacement has been entered.

Features

Tips and common mistakes

Frequently asked questions

Which regex flavour is this?

The browser's JavaScript engine — ECMAScript regular expressions, the same syntax used in web development and Node.js. Python, PCRE, Java and .NET support different syntax and additional features, so patterns do not always transfer.

Why does my pattern return only one match?

The g (global) flag is off. With g ticked, every non-overlapping match is found; without it the engine stops at the first. The flag also decides whether a replacement affects one match or all of them, and g is on by default.

What does each flag do?

i ignores case, m makes ^ and $ match at line breaks rather than only the start and end of the whole text, s lets the dot match newline characters, and u switches on Unicode mode. g finds all matches instead of just the first.

Can a bad pattern hang the page?

Yes. JavaScript regex has no execution limit and the tester does not run patterns in a worker or with a timeout, so a pattern that backtracks catastrophically — nested quantifiers applied to a long, nearly matching string — can freeze the tab until the browser stops it. Keep the test text short while developing such patterns.

Does it support named groups and lookbehind?

Patterns are passed straight to your browser's engine, so support follows the browser: current versions of Chrome, Firefox, Safari and Edge support named groups and lookbehind.

Can I test a replacement?

Yes. Type into Replace with and the replaced text appears in a read-only preview; Copy result copies it. Capture-group references such as $1 and the whole-match reference $& follow JavaScript substitution rules.

Patterns and test text are processed in your browser; nothing is uploaded.