regex-tester
Test a pattern against sample text with live highlighting. Options are labeled to match .NET's RegexOptions enum. Uses JavaScript's regex engine under the hood — see notes below for where that differs from .NET.
client-side only
RegexOptions mapped
pattern.regex
highlighted matches
Enter a pattern and test string.
// RegexOptions mapping
- IgnoreCase → JS
iflag — behaves the same way. - Multiline → JS
mflag — same meaning in both:^/$match at line breaks, not just string start/end. - Singleline → JS
sflag (dotAll). Careful: .NET's "Singleline" and JavaScript's naming here point at the same behavior (.matches\n) despite the confusingly similar name to Multiline — they're independent flags in both engines.
// where .NET regex and JS regex actually diverge
- Balancing groups (
(?<name1-name2>...)) — a .NET-only construct for matching nested/balanced structures. No JS equivalent; a pattern using this can't be tested here. - Named group syntax — both support
(?<name>...), so this one's actually fine across both. - Right-to-left matching (
RegexOptions.RightToLeft) has no JS equivalent. - Possessive quantifiers and atomic groups — supported in .NET 7+, not supported in JS.
If your pattern only uses standard character classes, quantifiers, anchors, and groups (which covers most real-world validation patterns), what you see here will match .NET's behavior exactly.
For the vast majority of patterns you'll write in a backend service — validation, parsing, log scraping — .NET's regex engine and JavaScript's behave identically, since both are backtracking engines with very similar syntax. The differences that matter show up in a few specific spots: