§
§ · free tool

Regex tester. Live, with capture groups.

Type a JavaScript regex and a test string. Matches highlight live. Capture groups, named groups, replace preview, all six flags, plus a library of common patterns (email, URL, phone, ISO date, IPv4, UUID). Browser-only.

Type a JavaScript regex and a test string. Matches highlight live. Capture groups appear in the side panel with positions and content. Optional replace preview shows the transformed result. Library of common patterns — pick and edit.

/ / gi
Flags
Common patterns:
·

$1, $2 reference capture groups · $& full match · leave blank to skip preview.

Highlighted result
// matches appear highlighted here
verdict
matches + groups

Privacy: regex evaluation happens in your browser. Nothing is sent or logged.

§ 02 · common patterns

Eight patterns. Battle-tested defaults.

Email. The simple pragmatic version, not the full RFC 5322 monster. The pattern \b[\w.+-]+@[\w-]+\.[\w.-]+\b matches 99% of real email addresses. The full RFC 5322 regex is over 6,000 characters and matches things almost no real email service accepts. The pragmatic version is what every modern web framework actually uses.

URL. Matches http and https URLs with optional paths and query strings. Doesn't validate top-level domain or check the URL actually resolves — that's a different job. For URL-shape detection in user input or text scraping, this works. For URL parsing where you need the host, path, query separately, use the native URL constructor instead.

ISO date. Matches ISO 8601 dates — the date-only form (2026-05-02) and the full datetime form (2026-05-02T10:30:00Z and 2026-05-02T10:30:00.999Z). Capture groups break out the year, month, day, hour, minute, second. Doesn't validate calendar correctness — 2026-13-99 will match. Pair with a date library for that.

IPv4. Matches IPv4-shaped strings. Doesn't validate octet ranges (256.256.256.256 will match) — that needs a stricter pattern with each octet bounded to 0-255 explicitly. For host-input validation, use the more careful pattern; for log scraping, this looser pattern is faster.

UUID v4. Strictly UUID v4 — the version digit (4) and the variant bits (8, 9, a, b) are encoded in the pattern. UUIDs of other versions (v1 timestamp-based, v3/v5 hash-based) will not match. Useful for filtering log entries by UUID type or for validating session-token format.

Hex color. Matches #fff (3-digit), #ffffff (6-digit), and #ffffffff (8-digit with alpha). Useful for extracting color references from CSS or design tokens. Pair with our Color Contrast Checker to verify accessibility on the colors found.

URL slug. Anchored to start and end of line — matches only strings that are valid URL slugs (lowercase, digits, hyphen-separated, no leading or trailing hyphen). Useful for validating slug input. Pair with our Slug Generator for the generation side.

Phone (US/intl). Loose phone-shape detection — country code optional, area code with or without parens, hyphen / dot / space separators. Doesn't validate region or check the number actually exists; for that, use the official libphonenumber library.

§ 03 · when to use this

Four jobs this tool covers.

Job 1: Develop a regex against test data. Type your pattern, paste representative test data, watch matches highlight live. Iterate until the regex catches what you want and ignores what you don't. Once it works here, copy into your codebase. Catches mistakes early without the dev-loop overhead of saving and re-running the script.

Job 2: Debug a regex that's misbehaving in production. When a production regex matches too much or too little, paste it here with the failing input. The match-and-group panel shows exactly which substrings matched (or didn't), making it obvious which part of the pattern is wrong. Faster than adding console.log to your production code.

Job 3: Test rename / redact rules. Type your regex and a replacement string ($1, $2 references). The replace preview shows the transformed text live. Useful for testing log-redaction patterns before deploying, or for previewing a rename script before running it across a codebase. Pair with our Case Converter for case-shape rename rules.

Job 4: Learn regex by example. Click a preset, then study the pattern. The match panel shows what each capture group caught. Modify the pattern slightly, see what changes. The fastest way to internalise regex syntax is to play with patterns against representative input — and the only way to do that without a Node REPL is a regex tester.

§ 04 · questions

Six questions users ask.

Which regex flavor does this use?

JavaScript RegExp — the one used by Node, every browser, and most modern build tooling. Differs from PCRE (Perl / PHP / Python re) in a few notable ways: no possessive quantifiers, no atomic groups, lookbehind support added in ES2018 so it requires modern engines, named capture groups use (?<name>...) syntax. For PCRE-specific patterns (especially backtracking-control), test in your target language. For most standard patterns (email, URL, ISO date, slug), JS regex behaves identically to other flavors.

What do the six flags do?

g (global) finds all matches, not just the first; required for replace-all behavior. i (insensitive) ignores case so /apple/i matches APPLE. m (multiline) makes ^ and $ match line starts/ends rather than only string starts/ends. s (dotAll) makes . match newlines too — without s, . skips line breaks. u (unicode) enables full Unicode support including code-point aware matching for emoji and non-BMP characters. y (sticky) anchors matches at the lastIndex position only — used in tokenizers and parsers. Toggle each flag with the chip above the regex input.

How do capture groups work?

Parentheses in the regex pattern create capture groups. /(\w+)@(\w+\.\w+)/ captures two groups from email-shaped strings — the local-part and the domain. The matches panel shows each group's content and position. Named groups via /(?<user>\w+)@(?<domain>\w+\.\w+)/ assign labels you can reference in JavaScript via match.groups.user. Non-capturing groups (?:...) group for quantifier purposes without creating a capture slot — useful for performance and clarity.

What's the replace preview for?

Type a replacement string in the replace field. We run str.replace(regex, replacement) and show the result live. Replacement strings can use $1, $2, $3 to reference capture groups, $& for the full match, $` for content before the match, $' for content after. Useful for testing rename rules, redaction patterns, or text transformations before running the same regex against a real codebase or dataset.

Why does my regex run forever / freeze the page?

Catastrophic backtracking. Patterns with nested quantifiers like /(a+)+b/ or /(.*?)+x/ create exponential search spaces on input that doesn't match. The browser may freeze or take seconds-to-minutes on inputs over a few KB. We catch obvious infinite-loop conditions (timeout after 1 second), but the right fix is to rewrite the regex without nested quantifiers or to use atomic groups in PCRE flavors. A common rewrite: replace (a+)+ with a+ alone, or use possessive quantifiers if your engine supports them.

Is the text I paste sent anywhere?

No. Regex evaluation uses the browser's native RegExp object — runs entirely client-side. The page is static HTML; the only network request is the initial page load. Safe for sensitive log data, customer records, or any text you'd not want to upload to a third party.