ToolJutsu
All tools
Developer Tools

Regex Tester

Test regular expressions with live match highlighting.

Flags
Examples:
0 chars
Flag reference
  • g — find every match, not just the first
  • i — match letters regardless of case
  • m — ^ and $ match at line breaks
  • s — . also matches newline characters
  • u — treat the pattern as Unicode code points
  • y — match only from lastIndex onward
Processed on your device. We never see your files.

How to use Regex Tester

What this tool does

A regex tester lets you write a regular expression and instantly see what it matches against a sample of text. You type a pattern, choose flags with checkboxes, and paste a test string; the tool builds a RegExp, runs it, and shows three things at once — the total number of matches, a detailed list of each match with its index and capture groups, and your text re-rendered with every match highlighted. If the pattern is invalid, a clear error explains why instead of leaving you guessing. Everything runs locally in your browser.

Why you might need it

Regular expressions are powerful but unforgiving: a single misplaced quantifier or an unescaped dot changes the result completely. Testing a pattern by editing code, re-running it, and reading console output is slow. A live tester closes that loop — you change one character of the pattern and immediately see the effect on real input. It is the fastest way to build a pattern for validating an email field, extracting values from log lines, finding every URL in a document, or writing a find-and-replace rule with confidence before you ship it.

How to use it

  1. Type your pattern into the Regular expression box (without the surrounding slashes).
  2. Tick the flags you need — g to find every match is on by default.
  3. Paste the text you want to test into the Test string box.
  4. Read the match count, then switch between Highlight and Match list to inspect the results.
  5. Use one of the Examples buttons for a ready-made starting point.

Common pitfalls

The most common surprise is forgetting the g flag. Without it, only the first match is found, so a pattern that looks correct seems to miss everything after the first hit. Another is escaping: inside this tool you type the raw pattern, so a literal dot is \. and a literal backslash is \\. Character classes also trip people up — [a-z] matches one lowercase letter, and adding + makes it match one or more.

Anchors behave differently with the m flag. By default ^ and $ match only the very start and end of the whole string; with m they also match at every line break. If your pattern can match an empty string — for example a* — a global scan would normally loop forever, but this tool advances past zero-length matches automatically so the result is still correct.

Tips and advanced use

Use capture groups to pull structured data out of text: wrap the parts you want in parentheses and read them back in the match list. Named groups like (?<year>\d{4}) work too. When you only care about grouping and not capturing, use a non-capturing group (?:...) to keep the match list clean.

Turn on the i flag for case-insensitive matching, s so that . also spans newlines, and u when your pattern uses Unicode escapes or needs to handle characters outside the basic plane. Because the JavaScript engine differs in small ways from PCRE and other flavours, always test a pattern here before relying on it — and since nothing leaves your device, it is safe to do that with production log samples or other sensitive text.

Frequently asked questions

Is my test string sent anywhere?
No. The pattern and the text are evaluated entirely in your browser using JavaScript's built-in RegExp engine. Nothing is uploaded or stored, so you can safely test patterns against real data — confirm it in your browser's Network tab.
Which regex syntax does this support?
It uses the JavaScript regular expression engine, so everything valid in JavaScript works: character classes, quantifiers, lookahead, lookbehind, named groups, and Unicode property escapes when the u flag is on. Note that JavaScript syntax differs slightly from PCRE, Python, or .NET.
Why does my pattern with the g flag match the same spot forever?
A pattern that can match an empty string would loop endlessly in global mode. This tester detects a zero-length match and manually advances past it, so empty matches are reported once and the scan finishes.
How do I see capture groups?
Switch to the Match list view. Each match shows its starting index, the matched text, and every capture group in order. An empty group is labelled so you can tell it apart from a group that did not participate.
What is the difference between the highlight and list views?
Highlight re-renders your test string with every match marked in colour, which is best for seeing where matches fall. The match list breaks each match out individually with its index and capture groups, which is best for inspecting what the pattern actually captured.

Related tools