Regex Tester
Live pattern matcher with flags and groups
The Regex Tester evaluates a JavaScript-compatible regular expression against a block of test text and highlights matches as you type. It supports all standard flags, named and unnamed capture groups, and shows you exactly what each match contains.
Useful for building regex patterns for validation, extracting data from logs, search-and-replace in editors, and learning regex by experimenting.
What it shows
- All matches highlighted in the test text.
- Match count and individual match content.
- Each match's captured groups (numbered and named).
- Error messages for invalid patterns.
Supported flags
g— global, find all matches (not just the first).i— case-insensitive.m— multiline mode (^and$match start/end of each line).s— dotall,.also matches newline.u— Unicode mode.y— sticky, matches only fromlastIndex.
Worked example
Pattern: (\d{4})-(\d{2})-(\d{2}) with flag g
Test text: Released on 2024-11-15, updated 2025-03-22.
- Match 1:
2024-11-15— groups: [2024], [11], [15] - Match 2:
2025-03-22— groups: [2025], [03], [22]
The same pattern with named groups: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) — now each match has a labelled year, month, and day.
When this is useful
Prototyping patterns before pasting them into your code editor's search, validating that a pattern actually matches the data you expect, debugging why a pattern is not matching, and learning regex interactively.
JavaScript-flavored regex
This uses the browser's built-in regex engine, which is JavaScript-flavored. Patterns that rely on PCRE-only features (like lookbehind in older browsers, recursive patterns, or some POSIX character class names) may not behave identically to Perl, Python, or grep. For production code, always test in the actual runtime.
Frequently asked questions
Why is my pattern not matching as expected?
Common causes: missing the g flag (you get only the first match), needing to escape special characters like dots and parentheses, or expecting greedy behaviour where lazy is needed (use *? or +?).
Does this support lookbehind?
Modern browsers support lookbehind ((?<=...) and (?<!...)). If the pattern fails to compile, your browser may be older.
How do I match a literal period or parenthesis?
Escape it with a backslash: \., \(, \).