Skip to content
Marvin's Toolbox.

Search tools

Type to filter all tools

Regex Tester

Test a regular expression against your own text and see every match highlighted as you type. Capture groups are color coded in the pattern, the matched text and the match list, so you always see which parentheses captured what. Toggle any JavaScript regex flag and copy all matches as a list.

Everything runs locally in your browser. Your data never leaves your device.

Quick reference

\d \w \sdigit, word character, whitespace
\D \W \Sanything but a digit, word character, whitespace
.any character except a newline
[abc]one of a, b or c
[^abc]any character except a, b or c
[a-z]a character from a to z
a|ba or b
^ $start and end of the text, or of a line with the m flag
\bword boundary
a* a+ a?zero or more, one or more, optional
a{2,4}two to four times
a+?lazy, match as little as possible
(…)capture group
(?<name>…)named capture group
(?:…)group without capturing
(?=…) (?!…)lookahead, positive and negative
(?<=…) (?<!…)lookbehind, positive and negative
\1back reference to group 1
\n \tnewline, tab
\.a literal dot, escape any special character

Next steps

Send this tool's output straight into another tool.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Convert text into every case at once: title case in the APA, AP, Chicago, MLA, Bluebook, AMA and NYT styles, sentence case, upper, lower, camelCase, snake_case, kebab-case and more.

Count words, characters, sentences, paragraphs, lines and more as you type, with estimated reading and speaking time.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Compare two texts and see every added, removed and changed line highlighted, side by side or inline, with the changed words marked within each line. Ignore case, whitespace or blank lines, read a summary of how much changed, and export the result as a unified diff.

Paste a UUID to see what it carries: version, variant, and for time-based versions the exact timestamp, clock sequence and node. Also shows the raw bytes, the 128-bit integer and the URN form.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36. Type into any field and the others update as you go. Handles huge integers without losing precision and accepts 0x, 0b and 0o prefixes.

Convert between scientific notation and full numbers as you type. Reads 1.23e5, 1.23 × 10^5 and plain numbers, shows the value written out, in normalized scientific notation and in engineering notation, and can round to any number of significant digits.

About the Regex Tester Tool

This tool runs a JavaScript regular expression against your own test text and shows the result as you type. Every match is highlighted in the text itself, and each capture group gets its own color, shown on the group in the pattern, on what it captured in the text and in the match list, so you always see which parentheses produced which capture.

It is built for the everyday loop of writing a pattern, checking what it really matches and adjusting it until it does. An invalid pattern reports the exact error from the regex engine instead of failing quietly, and a quick reference of the common tokens sits right under the tool.

What you can do

  • Test a regular expression against sample text and see the matches instantly.
  • Highlight every match and capture group in the text, each in its own color.
  • See each capture group colored in the pattern itself, matching its captures.
  • Inspect numbered and named capture groups match by match.
  • Toggle the JavaScript regex flags g, i, m, s, u and y.
  • See the exact line, column and character index of every match.
  • Extract everything a pattern matches and copy it as a plain list.
  • Debug an invalid regex with the engine's real error message.

How to use the Regex Tester

  1. 1Type your pattern into the Pattern field, without the surrounding slashes.
  2. 2Pick the flags you need. Global is on by default, so every match is found.
  3. 3Paste your test text below. Matches highlight while you type, in the pattern or in the text.
  4. 4Read the match list for positions and captured group values.
  5. 5Copy all matches as a list, or send them on to another tool.

JavaScript regex flavor

Patterns run on the browser's own regex engine, so what matches here is exactly what matches in JavaScript and TypeScript, in RegExp, String.match, String.matchAll and String.replace. That includes named groups like (?<year>\d{4}), lookaheads and lookbehinds, and Unicode property escapes like \p{Letter} when the u flag is on.

Other engines differ in places. PCRE, Python and Go each have their own syntax quirks, so a pattern that works here may need small changes elsewhere. The common building blocks in the quick reference behave the same almost everywhere.

What the flags do

Global (g) finds every match instead of stopping at the first, and is what you want for testing almost always. Ignore case (i) makes letters match both cases. Multiline (m) lets ^ and $ match at the start and end of every line rather than the whole text. Dot all (s) lets . cross newlines. Unicode (u) turns on strict Unicode mode, where emoji count as one character and \u{…} escapes work. Sticky (y) requires each match to start exactly where the previous one ended.

Working with capture groups

Parentheses capture the part of the match they enclose, numbered from 1 in the order they open. A named group (?<name>…) captures under a readable name as well. The tester colors each group in the pattern and gives its captures the same color in the highlighted text and the match list, including groups that did not take part, so you can see exactly which parentheses matched what.

When a group captures the wrong thing, the colors usually show why at a glance. Once the pattern captures what you want, Find and Replace applies it with $1 style replacements, and the String Escaper escapes a literal string for use inside a pattern.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Format code in JavaScript, TypeScript, JSON, JSON5, HTML, Vue, CSS, SCSS, LESS, Markdown, YAML, GraphQL, XML and SQL. Pick tabs or spaces, set the indent width, and format the input in place with one click.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Escape text into HTML entities or decode entities back to plain text. Choose named or numeric entities, escape only the unsafe characters or everything outside ASCII, and read the result live.

Reveal the characters you can't see in a text: zero-width spaces, non-breaking spaces, bidi marks, control characters and CRLF versus LF line endings. Inspect every occurrence and clean them out with a click.