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
code generator
highlighted matches
Enter a pattern and test string.
cheat sheet
Anchors
^ String start
$ String end
Classes
. Any character
\d Digit [0-9]
\w Word character
\s Whitespace
Quantifiers
* 0 or more
+ 1 or more
? 0 or 1
{n,m} n to m times
Groups
(abc) Group
(?:abc) Non-capturing
(?<name>...) Named group

// RegexOptions mapping

// where .NET regex and JS regex actually diverge

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:

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.