manage_search Developer

Regex Tester with Plain-English Explanations

Type a pattern and some test text to see every match listed with its position, length and capture groups. Start from presets for emails, URLs, US phone numbers, IPv4 addresses, dates, hex colours and HTML tags, or click Explain this Regex for a plain-English breakdown from an AI model. Patterns run on the .NET regex engine, which reads most JavaScript, Python and PHP patterns the same way, with a few differences covered below.

Built by Jose Hunt · Checked 20 Nov 2026

Regex Pattern
Test String
info

How to use

Enter a regex pattern and test string to see matches in real-time.

2-second timeout on each run.

  • check_circle Live list of matches
  • check_circle Capture groups & match details
  • check_circle Plain-English AI explanations

What is a Regex Tester & Explainer?

A regex tester runs a regular expression against sample text and shows what it matches, so you can fix the pattern before it goes into code. Type a pattern, paste some text, and the tool lists every match with its index, its length and the value of each capture group. The list updates as you type.

The pattern runs on our server with .NET's System.Text.RegularExpressions engine. Everyday syntax behaves as it does in JavaScript, Python or PHP, but not all of it, so a pattern that works here can still behave differently in your code. Test it in the engine you'll ship with as well. The differences that bite most often are under How it works.

The Explain this Regex button is the only part that uses AI. It sends your pattern, not your test text, to an AI model through OpenRouter.

If your pattern lives in a JSON config file, every backslash has to be doubled there, so \d becomes \\d. Our guide to JSON parse errors explains why a lone \d breaks the file. To check the JSON itself, use the JSON Formatter.

When should you use it?

  • check_circle Checking a form validation pattern against good and bad samples before it ships
  • check_circle Pulling dates, IDs or amounts out of log lines and checking each capture group
  • check_circle Working out what an inherited pattern does, with the AI explanation next to the live matches
  • check_circle Testing a pattern for a .NET application, where this is the engine your code will use

Example outputs

Input: the pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) against "Invoice 2026-11-20, due 2026-12-04. Ref 20261120.", then Explain this Regex on that pattern (run 20 November 2026). Separately, the Email preset [\w.-]+@[\w.-]+\.\w+ against "Write to [email protected] or [email protected]."
Result: 2 matches. Match 1 is 2026-11-20 at index 8, length 10, with Group 1: 2026, Group 2: 11, Group 3: 20. Match 2 is 2026-12-04 at index 24 (2026, 12, 04). The AI explanation began: "This regex matches a date formatted as `YYYY-MM-DD` and assigns the parts to named capture groups for easy retrieval." It then explained each group and hyphen in a bulleted list (...). The Email preset found [email protected] at index 14 and [email protected] at index 36.
What to notice: 20261120 isn't matched, because the pattern needs the hyphens. Nothing checks the values, so 2026-13-45 would match too, and the AI explanation didn't mention that. Its answer arrived with Markdown ** and backticks, which show as typed. The Email preset dropped "ruff+" from the first address, because + isn't in [\w.-]. Treat the presets as starting points, not validators.

How it works

The tool builds a .NET Regex from your pattern with no options set and a 2-second match timeout, then collects every match in the test text. For each match it shows the matched text, its index (counting from 0), its length and each capture group in order. Named groups are listed by number, not by name. Matching reruns whenever the pattern or the text changes. Matches appear in a list below the text; they aren't highlighted inside it.

There are no flag checkboxes. Switch options on inline at the start of the pattern: (?i) ignores case, (?m) makes ^ and $ match at every line break, (?s) lets . match a newline, and (?x) ignores spaces in the pattern (Microsoft Learn: regular expression options). Don't type JavaScript slashes. /\d+/g is read as a literal slash, digits, a slash and a g, so it matches nothing in ordinary text.

The biggest difference from JavaScript is character classes. In .NET, \d matches any Unicode decimal digit, so it matches Arabic-Indic ١٢٣ as well as 123, and \w covers letters in every script (Microsoft Learn: character classes). In JavaScript, \d is only [0-9] (MDN). .NET has an ECMAScript mode that narrows these, but it can only be set in code, not inline, so this tool always uses .NET's own rules.

Each run gets 2 seconds. The limit is there for catastrophic backtracking, where a pattern such as (a+)+$ tries an exploding number of paths on text that almost matches (Microsoft Learn: best practices). When the limit is hit, .NET throws a timeout error. The tool doesn't catch it, so the page stops working until you reload it. We saw this with (a+)+$ against 30 a's followed by an exclamation mark.

Explain this Regex sends "Explain this regex:" followed by your pattern to an AI model through OpenRouter. The system prompt tells the model to act as a regex expert, explain the pattern step by step in plain English, break down each part, and keep the answer under 200 words. The answer streams in as it's written and can differ between runs. It's shown as plain text, so Markdown marks such as ** and ### appear as typed. The model doesn't run your pattern, so check its explanation against the real matches.

Tips for better results

  • tips_and_updates Paste text that should not match as well as text that should. A pattern that matches every good sample can still match bad ones.
  • tips_and_updates Use a lazy quantifier when you want the shortest match. On "<b>bold</b> and <i>italic</i>", <.*> returned the whole line as one match, while <.*?> found the four tags.
  • tips_and_updates If the pattern will also run in JavaScript, write [0-9] instead of \d so both engines match the same digits.
  • tips_and_updates Avoid nested quantifiers such as (a+)+. Here they hit the 2-second limit; in production code they can stall a server.

Frequently Asked Questions

Which regex flavour does it use?
Microsoft's .NET engine (System.Text.RegularExpressions), running on our server. Lookaheads, lookbehinds, named and numbered groups, backreferences and inline flags all work. Some classes are wider than in JavaScript: \d matches any Unicode digit here but only 0 to 9 in JavaScript (Microsoft Learn).
How do I set flags such as case-insensitive?
Put them inline at the start of the pattern: (?i) for case-insensitive, (?m) so ^ and $ match at line breaks, and (?s) so the dot also matches newlines. Combine them as (?im). Don't wrap the pattern in slashes with flags after it, because the slashes are read as part of the pattern.
What happens if my pattern takes too long?
Each run is stopped after 2 seconds to guard against catastrophic backtracking, which usually comes from nested quantifiers such as (a+)+. At the moment the page doesn't recover from that stop, so you'll need to reload it. Make the quantifiers more specific before you try again.
Why does my pattern match here but not in my code?
Usually escaping or engine differences. In most languages a backslash inside a normal string must itself be escaped, so \d has to be written as \\d unless you use a raw string. Character classes and default options also differ between engines, so test in the language you'll ship with.
What is sent to the AI?
Only your pattern, and only when you click Explain this Regex. It's sent to an AI model through OpenRouter; your test text isn't included. We don't store the pattern or the explanation. OpenRouter and the model provider handle the request under their own policies, which our Privacy Policy explains.

Related tools