Test regex patterns with live matching, capture groups, flags (g/i/m/s/u), pattern library with common expressions, find & replace, and detailed match breakdown
Regex flavors are not interchangeable. The pattern that works in your text editor may fail in your code because JavaScript, PCRE (used by PHP, Perl, and grep -P), Python's re module, .NET regex, and POSIX BRE/ERE implement subtly different features. Lookbehind assertions work in JavaScript (ES2018+), Python, and .NET but not in Ruby or older Safari. Possessive quantifiers (a++) exist in PCRE and Java but not in JavaScript. Named capture groups use different syntax across flavors: (?P<name>...) in Python, (?<name>...) in JavaScript and .NET, and (?P<name>...) or (?<name>...) in PCRE depending on version. This tester runs the JavaScript (ECMAScript) regex engine, which is what the browser and Node.js use, so the results here match production behavior in any JavaScript-based system. Beyond flavor differences, the most dangerous pitfall in regex is catastrophic backtracking. A pattern like `(a+)+b` matching against `aaaaaaaaaaaaaaaaaaaaaac` takes exponential time because the engine tries every possible way to split the a's between the inner and outer groups. Real-world examples brought down Cloudflare in 2019 and Stack Overflow in 2016. This tester shows match time and warns when patterns exhibit backtracking behavior on your test input, which catches the bug at build time rather than in production.
Initializing in your browser…
Test and debug XPath expressions against XML documents. See matched nodes, values, and counts in real-time.
Convert text between 12 cases: UPPERCASE, lowercase, Title Case, camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, dot.case, path/case, Sentence, and Alternating
Count words, characters, paragraphs, sentences with reading time, speaking time, readability scores (Flesch, Gunning Fog), and word frequency analysis
You wrote a pattern to pull order IDs from log lines and need to confirm it matches the real format and captures the number.
Pattern + test string
/order-(\d{4,})/g on "ok order-10473 then order-9 fail"Matches
Match 1: "order-10473" group 1 = 10473
("order-9" rejected, needs 4+ digits)Every match and capture group is highlighted live against your real sample, so you immediately see that the `{4,}` quantifier correctly excludes the 1-digit case. An explainer breaks the pattern into plain English, turning regex debugging from trial-and-error into something you can reason about.
Regex flavors are not interchangeable. The pattern that works in your text editor may fail in your code because JavaScript, PCRE (used by PHP, Perl, and grep -P), Python's re module, .NET regex, and POSIX BRE/ERE implement subtly different features. Lookbehind assertions work in JavaScript (ES2018+), Python, and .NET but not in Ruby or older Safari. Possessive quantifiers (a++) exist in PCRE and Java but not in JavaScript. Named capture groups use different syntax across flavors: (?P<name>...) in Python, (?<name>...) in JavaScript and .NET, and (?P<name>...) or (?<name>...) in PCRE depending on version. This tester runs the JavaScript (ECMAScript) regex engine, which is what the browser and Node.js use, so the results here match production behavior in any JavaScript-based system. Beyond flavor differences, the most dangerous pitfall in regex is catastrophic backtracking. A pattern like `(a+)+b` matching against `aaaaaaaaaaaaaaaaaaaaaac` takes exponential time because the engine tries every possible way to split the a's between the inner and outer groups. Real-world examples brought down Cloudflare in 2019 and Stack Overflow in 2016. This tester shows match time and warns when patterns exhibit backtracking behavior on your test input, which catches the bug at build time rather than in production.
Build and test regex patterns for email addresses, phone numbers, URLs, or custom input formats before embedding them in your code.
Craft patterns to extract timestamps, error codes, or IP addresses from log entries, verifying matches against sample lines.
Test complex find-and-replace patterns with capture groups before running them across a codebase or document.
Experiment with regex syntax and instantly see what matches, a much faster feedback loop than modifying and re-running scripts.
Pattern: ^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,}$, matches standard email addresses.
Pattern: (\d{4})-(\d{2})-(\d{2}), captures year, month, and day from ISO dates.
The tester evaluates your regex with every keystroke, highlighting matches in the test string and listing capture groups separately. Each of JavaScript's six regex flags has distinct behavior: the `g` flag makes a pattern stateful (lastIndex advances between matches, which matters when you use the same RegExp object for multiple tests), the `i` flag makes matching case-insensitive using Unicode case folding when the `u` flag is also set, the `m` flag changes `^` and `$` to match at line boundaries rather than only at string boundaries, the `s` flag makes `.` match newlines (without `s``.` matches everything except `\n`), the `u` flag enables proper Unicode handling including surrogate pair support for characters outside the BMP, and the `y` flag performs sticky matching anchored at lastIndex.
Capture groups come in three forms. Numbered groups `(...)` are the classic form, referenced by `$1``$2`etc. in replacements. Named groups `(?<name>...)` are referenced by `$<name>` and make complex patterns dramatically more readable, a date-parsing regex using named groups like `(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})` is far clearer than one relying on position alone. Non-capturing groups `(?:...)` group atoms for quantifiers without allocating a capture slot, which matters for performance on patterns used in tight loops. The tester displays each capture group separately with the captured substring and its position, making it easy to verify that group boundaries are where you expect.
Common patterns that trip up regex writers: matching email addresses is famously harder than it looks (the RFC 5322 grammar for valid email is about 6,400 characters as a regex, so most validators use a simplified approximation that accepts some invalid addresses and rejects some valid ones). Matching URLs has the same problem plus the complication of internationalized domain names. Matching HTML with regex is actively harmful because HTML is not a regular language, use a real parser. For CSV parsing, regex can handle simple cases but falls over on embedded commas, quoted strings, and multiline fields, so use a CSV library. The tester is best used for validating specific field formats where the grammar is actually regular: phone numbers, postal codes, semver strings, hex color codes, and log-line patterns where the source format guarantees regularity.
It uses the JavaScript (ECMAScript) regex engine, which is what runs in all modern browsers and Node.js.
Most basic patterns are cross-compatible. However, features like lookbehinds, possessive quantifiers, or atomic groups may differ between engines. This tool reflects JavaScript behavior.
g = match all occurrences (not just the first), i = case-insensitive, m = ^ and $ match line boundaries, s = dot matches newlines, u = full Unicode matching.
Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.