RegexTester.dev Logo

Regex Tester & Validator

.NET Regex Tester

Test C# / .NET regular expressions against the real Microsoft regex engine — compiled to WebAssembly.

Free, no signup — runs entirely in your browser on RegexTester.dev.

@"
"

Test your .NET regex against the real engine below

.NET regex: what makes it different

Variable-length lookbehind
.NET is unique: (?<=\w*\d*) is valid. Every other mainstream engine requires fixed width.
Balancing groups
(?<open>{)|(?<-open>)} — the construct that makes matched-brace parsing possible in pure regex.
Right-to-left mode
RegexOptions.RightToLeft searches from the end of the input — impossible to simulate with other engines.
Named groups
(?<name>…) with backreference \k<name>, and GroupCollection access by name in C#.

The .NET regex engine (System.Text.RegularExpressions) is the most powerful mainstream flavor: it is the only major engine with true variable-length lookbehind (?<=ab|cde), plus balancing groups (?<-depth>…) that can count nesting, and a right-to-left matching mode (RegexOptions.RightToLeft).

Those features are exactly why .NET patterns break in every generic online tester: simulated engines cannot reproduce them. This page runs the real .NET regex implementation compiled to WebAssembly — same lookbehind, same balancing groups, same match semantics.

.NET regex FAQ

Does .NET regex support variable-length lookbehind?

Yes — .NET is the only major engine that allows fully variable-length lookbehind, e.g. (?<=\d{2,4}-)\w. PCRE2 allows alternatives of different fixed lengths, while Python, Java, and JavaScript require a single fixed width.

What are balancing groups in .NET regex?

Balancing groups (?<-name>…) delete a previous capture, letting a pattern count nesting depth — the classic idiom for matching balanced parentheses or XML tags in pure regex. No other mainstream engine has this feature.

Is .NET regex the same as JavaScript regex?

No. .NET has lookbehind, named references \k<name>, atomic groups (?>…), right-to-left mode, and Unicode categories \p{…} — several of which JavaScript lacks or defines differently. Testing .NET patterns in a JS-based tester gives wrong answers; this page runs the real engine.