Skip to content

Regex Tester (.NET)

Test regular expressions with the real .NET engine: highlighted matches, named and numbered groups, replace preview and C# code. Runs in your browser.

Most online regex testers run JavaScript or PCRE, which differ from .NET in the details that bite: named groups (?<name>), balancing groups, lookbehind of any length, RegexOptions, $1 vs ${name} substitutions and Unicode classes. This page runs the real .NET 10 System.Text.RegularExpressions engine in your browser, so what matches here matches in C#, PowerShell (-match, -replace, Select-String) and anything else built on .NET.

Local only

Matched in your browser. Your pattern and test text are never sent to tclient.com.

This page runs .NET itself on your device (WebAssembly). Each run stops after 2 seconds, so a pattern with catastrophic backtracking reports a timeout instead of freezing the page.

Pattern
Without slashes or quotes, e.g. ^(?<user>[\w.]+)@(?<domain>[\w.-]+)$
Test text
Replace with (optional)
$1, ${name}, $& (whole match), $$ (a literal $)

2 matches ยท 1 ms

Contact alice@example.com or bob.smith+it@mail.example.org.
Not an address: carol@localhost

Matches and groups

#IndexLengthMatch ($0)${user}${domain}
1 8 17 alice@example.comaliceexample.com
2 29 29 bob.smith+it@mail.example.orgbob.smith+itmail.example.org

Use it in code

@"(?<user>[\w.+-]+)@(?<domain>[\w-]+(?:\.[\w-]+)+)"
// .NET 7+: source-generated, checked at compile time
[GeneratedRegex(@"(?<user>[\w.+-]+)@(?<domain>[\w-]+(?:\.[\w-]+)+)", RegexOptions.None, matchTimeoutMilliseconds: 2000)]
private static partial Regex MyRegex();

// Any version
var regex = new Regex(@"(?<user>[\w.+-]+)@(?<domain>[\w-]+(?:\.[\w-]+)+)", RegexOptions.None, TimeSpan.FromSeconds(2));
PowerShell: 'text' -match '(?<user>[\w.+-]+)@(?<domain>[\w-]+(?:\.[\w-]+)+)' is case-insensitive by default (like IgnoreCase); use -cmatch for case-sensitive.