Reconnecting… Connection lost. Reload Session expired. Reload

Regex Tester

Test regex patterns against sample input and review highlighted matches in real time.

By Pankaj Kumar · DevToolsHub· Last updated Jun 2026
Input Section

Regex pattern

Sample text

Output Section

Live match preview

Alice and Bob built DevToolsHub in Blazor.

Regex matches

Match metadata

What is a regex tester?

A regex tester (regular expression tester) lets you write a pattern and immediately see which parts of your sample text it matches, with visual highlighting and metadata showing the position and length of each match. Testing regex patterns interactively is far faster than running code in a terminal — you can refine a pattern in seconds, see edge cases highlighted in real time, and copy the final expression directly into your codebase.

Essential regex syntax reference

Regular expressions use a compact syntax where each character or construct has a specific meaning:

  • . — matches any single character except a newline
  • \d — matches a digit (0–9); \D matches any non-digit
  • \w — matches a word character (letter, digit, underscore); \W matches non-word
  • \s — matches whitespace (space, tab, newline); \S matches non-whitespace
  • ^ — anchors the match to the start of a line; $ anchors to the end
  • \b — word boundary — the position between a word character and a non-word character
  • * — zero or more of the preceding element; + — one or more; ? — zero or one
  • {n,m} — between n and m repetitions of the preceding element
  • [abc] — character class matching a, b, or c; [^abc] matches anything except a, b, or c
  • (group) — capturing group; (?:group) — non-capturing group
  • (?=ahead) — positive lookahead; (?<=behind) — positive lookbehind

How to use this tool

  1. Enter your regex pattern in the top editor.
  2. Paste your sample text in the lower editor.
  3. Matches are highlighted automatically as you type.
  4. Enable "Case insensitive" or "Multiline" flags using the checkboxes if needed.
  5. Review match count, index, and length in the JSON output panel.

.NET regex — what's different

This tester uses .NET's regex engine, which supports the full set of features found in most modern flavours plus some .NET-specific additions: named groups with (?<name>...), balancing groups for matching nested structures, and atomic groups with (?>...). Unlike JavaScript regex, .NET supports variable-length lookbehinds, which allows patterns like (?<=\d{2,4})- to look back a variable number of characters.

Practical regex patterns for developers

  • Email (basic): [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
  • URL: https?://[^\s/$.?#].[^\s]*
  • IPv4 address: \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
  • ISO date: \d{4}-\d{2}-\d{2}
  • Hex colour code: #([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b
  • Whitespace-only lines: ^\s*$ (use with multiline flag)

Performance considerations

Certain regex patterns cause catastrophic backtracking — the engine tries an exponential number of combinations before giving up. The most common cause is nested quantifiers such as (a+)+. If your regex is extremely slow on certain inputs, look for adjacent quantifiers and consider rewriting with atomic groups or possessive quantifiers to eliminate ambiguity in how the engine can match a given character.

FAQ
Does the tester update in real time?

Yes. Pattern and input changes trigger a debounced API test and a live highlighted preview.

How are matches shown?

Matches are wrapped visually in highlighted spans and listed with index and length metadata.

What regex flavour does this tool use?

The tester uses .NET regex, which supports most standard features including lookaheads, lookbehinds, named groups, and Unicode.

How do I match a whole word?

Use word boundary anchors: \b before and after the word — for example, \bword\b matches 'word' but not 'password'.

What does the dot (.) match in regex?

By default, dot matches any character except a newline. Use the s (single-line) flag to make dot match newlines too.

How do I make a regex case insensitive?

Enable the case-insensitive flag by adding (?i) at the start of your pattern, for example (?i)hello matches 'Hello', 'HELLO', and 'hello'.