FreeToolsToGo

Free Regex Tester

Write a regular expression, paste your test string, and see every match highlighted instantly. Supports all JavaScript regex flags (g, i, m, s, u, d), displays numbered and named capture groups, shows match index and length, and clearly surfaces regex syntax errors. 100% browser-side — your patterns and test strings never leave your device.

//g

Global — find all matches

🔣

Enter a regex pattern above to start matching.

Uses JavaScript (ECMAScript) regex — all matching runs in your browser, nothing is sent to any server.

Frequently Asked Questions

What regex flavor does this tester use?+

This tool uses JavaScript (ECMAScript) regular expressions via the native browser RegExp engine. This is the same regex flavor used in Node.js, Chrome DevTools, and most JavaScript frameworks. It supports features like named capture groups (?<name>...), lookaheads, lookbehinds, and unicode property escapes.

What do the regex flags do?+

g (global) — find all matches, not just the first. i (case-insensitive) — A matches a. m (multiline) — ^ and $ match line boundaries. s (dotAll) — . matches newlines. u (unicode) — enables full Unicode support and unicode property escapes. d (indices) — adds start/end index arrays to each match.

How do I use capture groups?+

Wrap part of your pattern in parentheses: (\d+) captures one or more digits. Named groups use (?<name>...) syntax — e.g. (?<year>\d{4}). This tool shows the content of every group for every match.

Why does my pattern match nothing?+

Common reasons: missing the g flag (only the first match is returned without it), anchors like ^ or $ not matching your input, unescaped special characters (. [ ] ( ) * + ? ^ $ { } | \), or a character class that doesn't cover your input. Check the error panel — if your pattern is invalid, the reason is shown there.

Is this safe to use with sensitive data?+

Yes. All matching happens locally in your browser using the native JavaScript RegExp engine. Your test strings and patterns are never uploaded to any server.

What is the difference between greedy and lazy quantifiers?+

Greedy quantifiers (*, +, {n,m}) match as much as possible. Lazy (non-greedy) quantifiers (*?, +?, {n,m}?) match as little as possible. Example: given <b>bold</b>, the pattern <.*> (greedy) matches the entire string, while <.*?> (lazy) matches just <b>.

Regular Expressions — A Developer's Guide

A regular expression (regex) is a sequence of characters that defines a search pattern. Originally formalized by mathematician Stephen Cole Kleene in the 1950s, regex is now built into virtually every programming language and text editor. JavaScript uses the ECMAScript regex standard, which this tool implements natively via the browser's RegExp engine.

How JavaScript Regex Flags Work

Flags modify how the pattern is interpreted. The g (global) flag finds all matches rather than stopping after the first. The i flag makes the match case-insensitive so Hello matches hello, HELLO, and HeLlO. The m flag makes ^ and $ match at the beginning and end of each line rather than the whole string — essential when your test string contains newlines. The s (dotAll) flag lets . match newline characters, which it does not by default. The u flag enables full Unicode support, needed for emoji and non-Latin scripts.

Capture Groups and Named Groups

Parentheses create capture groups: (\d+)-(\d+) matches a range like 10-20 and captures 10 and 20 separately. Named groups use the (?<name>...) syntax — e.g. (?<year>\d{4})-(?<month>\d{2}) — making the extracted values accessible by name rather than index. This tool displays every capture group for every match, making it straightforward to verify your extraction logic.

Greedy vs. Lazy Quantifiers

By default, quantifiers like *, +, and {n,m} are greedy — they consume as much of the string as possible while still allowing the overall pattern to match. A lazy (non-greedy) quantifier — formed by appending ? — matches as little as possible. The classic example: given <b>bold</b>, the pattern <.*> (greedy) matches the entire string from <b> to </b>, while <.*?> (lazy) matches just <b>.

Lookaheads and Lookbehinds

Lookaheads and lookbehinds let you assert that a pattern is (or isn't) preceded or followed by another pattern, without including that context in the match. foo(?=bar) matches foo only when followed by bar. foo(?!bar) matches foo when NOT followed by bar. (?<=bar)foo matches foo only when preceded by bar. These are zero-width assertions — they don't consume characters, so the matched value is just the part inside the main pattern.

Common Regex Patterns for Developers

Email-like: \b[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}\b. IPv4: \b(?:\d{1,3}\.){3}\d{1,3}\b. ISO date: \d{4}-\d{2}-\d{2}. Hex color: #(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b. URL slug: [a-z0-9]+(?:-[a-z0-9]+)*. These are starting points — always test with your actual data, as edge cases vary widely.