🔍

Regex Tester

Live regular expression tester with match highlighting, capture group inspection, and a built-in cheatsheet. No button needed — results update as you type.

/ /
Invalid regex
Flags
No pattern
Enter a pattern and test string to see matches.
Advertisement
About this regex tester

A regular expression (regex) is a compact pattern for finding, validating, and extracting text. This tester runs your pattern against any sample text and highlights every match live as you type — no Run button, no waiting. It uses the browser's built-in JavaScript regex engine (the RegExp object), so the syntax and behaviour match exactly what you'd get in Node.js or front-end JavaScript code.

Toggle the g (global), i (ignore case), m (multiline), s (dotAll), and u (unicode) flags with one click, or type them directly. Each match is listed with its start and end position, and every capture group is broken out into its own colour-coded chip so you can confirm exactly what your parentheses are pulling out. People use it to:

Everything runs locally in your browser. Your pattern and test text never leave the page — nothing is uploaded to a server, so it's safe to paste logs, sample records, or anything sensitive.

How to use
  1. Type your regex pattern (without the surrounding slashes) into the pattern field.
  2. Toggle flags such as g, i, m, s, or u — or type them in the flags box.
  3. Paste or type sample text into the Test String area; matches highlight live as you type.
  4. Inspect each match's position and capture groups in the list below the test string.
  5. Click Copy on any match to grab its text, or use a Quick Pattern preset to start from a tested example.
FAQ

It uses the JavaScript regex engine — the browser's native RegExp object. Patterns behave exactly as they would in Node.js or front-end JavaScript. Other languages like Python, Java, PHP, and Go have subtle differences (named-group syntax, escaping rules, lookbehind support), so verify before porting a pattern across engines.

g (global) finds every match instead of stopping at the first. i (ignore case) makes matching case-insensitive. m (multiline) makes ^ and $ match the start and end of each line. s (dotAll) lets . match newline characters too. u (unicode) enables full Unicode and code-point handling. Toggle them with the pills or type them in the flags box.

Wrap the part you want in parentheses, like (\d{4})-(\d{2})-(\d{2}), to create capture groups. Each match in the list below breaks out every captured group as a numbered, colour-coded chip so you can confirm exactly what each group pulls out before using it in your code.

This is a tester, not a replacer — it highlights and lists matches rather than rewriting text. But it's the fastest way to perfect the pattern first. Once your matches and groups look right, use the same pattern with String.replace or replaceAll in your code, referencing groups as $1, $2, and so on.

Yes. The Quick Patterns panel includes tested presets for emails, URLs, IPv4 addresses, US phone numbers, dates (YYYY-MM-DD), hex colours, credit cards, HTML tags, and US postal codes. Each one loads a pattern, the right flags, and matching sample text so you can see it work and adapt it.

Regex is iterative — you tweak a quantifier, add an anchor, fix an escape, and want to see the effect immediately. Live highlighting updates the matches and capture groups on every keystroke, which makes spotting why a pattern over- or under-matches far faster than re-running it manually.

Yes. Everything runs locally in your browser using the JavaScript engine. Your pattern and sample text are never uploaded or sent to any server, so it's safe to paste logs, sample data, or anything sensitive.