How to use the regex tester
- Type a pattern between the slashes, or pick a preset such as Email, URL, IPv4 or Date to start from something that works.
- Toggle flags: g finds all matches, i ignores case, m makes ^ and $ line-aware, s lets . match line breaks, u enables Unicode features.
- Paste sample text. Matches are highlighted on the right and listed below with their character offsets and groups.
- Switch on Replace preview and enter a replacement using $1, $<name> or $& to check a substitution before using it in code.
Features
- Live highlighting of every match with alternating colours so adjacent matches stay distinct
- Match list with start and end indices, numbered groups and named groups
- All six JavaScript flags with plain-language explanations
- Replace preview using the real String.prototype.replace semantics
- Presets for email, URL, IPv4, ISO date and hex colour patterns
- Clear error messages straight from the JavaScript engine for invalid patterns
JavaScript flavour, not PCRE
This tester runs your pattern through the browser's own RegExp engine, so results match exactly what Node.js and browsers do. Most syntax is shared with PCRE, Python and Java, but there are differences: JavaScript has no possessive quantifiers or atomic groups, no inline modifiers such as (?i) in older engines, and \p{...} Unicode classes only work with the u flag. Lookbehind (?<=...) is supported in all current browsers.
Why the g flag matters
Without g, a regex stops at the first match and String.replace only replaces the first occurrence. The tester mirrors that: turn g off to see exactly what a single-match call would return. The y (sticky) flag anchors each attempt at the previous match's end, which is useful for tokenisers but surprising elsewhere.
Limits and catastrophic backtracking
Sample text is capped at 100,000 characters and the match list at 2,000 matches to keep the page responsive. Some patterns, typically nested quantifiers such as (a+)+ applied to non-matching input, can take exponential time in any backtracking engine; if the page freezes, simplify the pattern or use an atomic-style rewrite with possessive-like constructs.