.*
Developer/Regex Tester

Regex Tester

Test regular expressions with live match highlighting and group capture.

LIVE MATCHLive highlightCapture groupsAll flagsError display
Saved Patterns· Auto-save on
Pattern
//
Test Text
Highlighted Preview
The Quick Brown Fox Jumps Over The Lazy Dog
Matches (9)
"The" @ index 0
"Quick" @ index 4
"Brown" @ index 10
"Fox" @ index 16
"Jumps" @ index 20
"Over" @ index 26
"The" @ index 31
"Lazy" @ index 35
"Dog" @ index 40
Data Source & Legal Disclaimer
Effective: 2026
Sources: Browser-side processing (no external API)

This tool runs 100% in your browser. All computation happens locally on your device — your input is never uploaded to any server. Results are for reference only.

See all data sources & update policy →
How it worksPage 2

How a pattern walks through your text — illustrated

A regular expression is a tiny state machine: the engine starts at the left, tries to match the pattern, and on success records a match then resumes just after it. Flags change the walk — g keeps scanning, i relaxes case, m re-anchors ^/$ to each line. Capturing groups (…) store sub-parts so you can pull out just the fraction of each hit.

Match → advance → repeat
A1B22C333← cursor never goes backMatch 1 → “1” at index 1Match 2 → “22” at index 3Match 3 → “333” at index 6With /g it records all three. Without it, only “1”.

Pattern /\d+/g against the string 'A1B22C333': the engine finds 1, resumes after it, finds 22, resumes, finds 333. Without the /g flag it stops after the first hit.

From vague to precise — three patterns

Same sandwich description, three extraction goals.

  1. Goal: any digits:/d+/g → catches 12 and 34 in “Order #12 · qty 34”
  2. Goal: a price:/\$\d+\.\d{2}/ → matches “9.99” and “19.50” only when dollar-prefixed
  3. Goal: an email-like id:/[a-z]+\d+/gi → case-insensitive run of letters then digits
  4. Trap to watch:Metacharacters must be escaped — a literal “.” needs \., or it matches any character
FAQ & detailsPage 3

To use it: open the tool, enter your inputs, and get instant results — test regular expressions with match highlighting, capture group display, and all standard flags. Everything runs locally; nothing is uploaded.

FreeToolHub Regex Tester & Highlighter is a free browser-based tool — test regular expressions with match highlighting, capture group display, and all standard flags. No signup, no upload; everything runs locally in your browser.

About this tool

What is this tool?

Test regular expressions with match highlighting, capture group display, and all standard flags (g, i, m, s, u, y). 100% in-browser, free.

Live highlightCapture groupsAll flagsError display

What Is the Regex Tester?

This tester is a live workbench for regular expressions: type a pattern and sample text, and every match highlights in place as you type. Beyond matching, it exposes the machinery developers actually need to debug patterns — numbered capture groups with their extracted values, all standard flags including global, case-insensitive, multiline, and dotall, and clear errors when the pattern fails to compile. Named groups render with their labels, and match counts update live, so you can tighten a pattern against real data instead of guessing whether it works.

Who Should Use This Tool?

Developers building validation rules for forms and APIs confirm a pattern accepts every valid input and rejects the invalid before shipping it. Data engineers writing extraction patterns for logs and text pull the capture groups they named straight from the panel. Anyone maintaining legacy regex — often the most feared code in a repository — pastes it here with representative input to understand what it actually matches before touching it. QA engineers construct boundary-case strings that expose greedy-versus-lazy and anchor mistakes before production does.

How Does It Work?

(1) Enter your pattern; compile errors show immediately with position hints. (2) Toggle flags — g for all matches, i for case-insensitivity, m for ^ and $ per line, s so dot matches newlines, plus u and y. (3) Paste sample text into the subject area; matches highlight live and the count updates. (4) Inspect results: each match with its index, and every capture group — numbered and named — with extracted text and a quick null check for optional groups that did not participate. Patterns and text stay local to your browser.

What Are the Most Common Regex Mistakes?

Five patterns of failure account for most regex bugs. Greedy quantifiers swallowing too much: .* in <.*> consumes to the last > on the line — switch to lazy .*? or use negated classes like [^>]*. Unescaped special characters: a literal dot must be \. or it matches any character, the classic email-validation leak. Missing anchors: ^\d{4} without ^ matches the last four digits anywhere — decide whether substring matching is intended. Catastrophic backtracking: nested quantifiers like (a+)+ against long non-matching input hang engines — unroll the pattern or add atomic-style possessive behavior where supported. And platform drift: lookbehind, named groups, and Unicode property escapes vary across engines, so test against the flavor you ship to. This tester runs the JavaScript flavor, which matches browser and Node environments exactly.

Frequently Asked Questions

Which regex flavor does this tester use?

JavaScript's built-in RegExp engine (ECMAScript) — the same one running in every browser and in Node.js. Constructs like lookahead (?=...), non-capturing groups (?:...), named groups (?<name>...), and unicode escapes all work as they would in production JavaScript code.

Why does my pattern match in another tool but not here?

Flavor differences. PCRE (PHP, grep) and Python's re support lookbehind variants, backreferences in patterns, and flags JavaScript lacks — and vice versa in small details. If a pattern works in PCRE but not here, look for constructs outside the ECMAScript set; the reverse direction usually involves JS-only named groups or the s flag.

What do the flags g, i, m, s, and u actually change?

g finds every match instead of stopping at the first; i makes matching case-insensitive; m makes ^ and $ match at every line start/end rather than string edges; s lets . match newlines; u enables full unicode handling (essential for emoji and non-Latin text). Combining g with a highlighter shows all occurrences, which is how this tool lists results.

How do I match text that spans multiple lines?

Two flags work together: m lets anchors (^, $) land on each line's boundaries, and s lets . cross line breaks. For patterns like 'start of a specific line', use ^yourtext with m enabled. For multi-line phrases, either enable s or replace spaces in your pattern with [\s\S] or \s+.

Which regex flags and engine does this tool support?

It uses the JavaScript RegExp engine with all standard flags: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode), and y (sticky). Live match highlighting shows all matches simultaneously. Capture groups are displayed in a numbered list below the match results for easy debugging.

Can I test regex patterns against multiline text?

Yes. Enable the m flag for multiline mode (^ and $ match line boundaries) or the s flag for dotall mode (. matches newlines). This is essential for parsing log files, extracting data from structured text, and validating multiline form input. All processing is 100% in-browser.

Related tools

Joke of the Day
Sep 17

Why did the fish get bad grades?

Free core, forever

Keep the Free Edition Free

No signups, no data sold. The core of every tool is free forever — the optional Pro plan adds batch processing, unlimited downloads, white-label exports and an ad-free experience.

Support me on Ko-fi— keep tools free

100% of proceeds go towards hosting & building more free tools.