Servinza logoservinza / tools

Regex Tester and Debugger

Test a regex pattern against sample text with live match highlighting. Free to use, no signup required for occasional use.

Test string will be highlighted here…

Common regex syntax

.Any character except newline
\dAny digit (0-9)
\wAny word character (letters, digits, underscore)
\sAny whitespace character
*0 or more of the preceding token
+1 or more of the preceding token
?0 or 1 of the preceding token
^Start of string/line
$End of string/line
[abc]Any one of a, b, or c
(group)Capturing group
a|bEither a or b

What is the Regex Tester?

The Regex Tester is a free online tool for writing and debugging regular expressions against real sample text. Regular expressions are a powerful way to search, validate, and extract patterns from text — matching email addresses, validating phone number formats, extracting IDs from log lines — but they're notoriously easy to get subtly wrong, and a pattern that looks correct can silently fail to match what you expect. This tool lets you enter a pattern, set flags such as global or case-insensitive matching, and paste in a block of test text, then immediately see every match highlighted directly within that text, along with a total match count and any captured groups. Rather than testing a regex inside application code and re-running your program after every tweak, you can iterate on the pattern here and see results instantly. Below the tester, a quick-reference table of common regex syntax — character classes, quantifiers, anchors, and groups — helps explain what each part of a pattern does, making the tool useful both for experienced developers doing quick validation and for anyone still learning regex fundamentals.

How to use it

Type your regular expression into the pattern field, and adjust the flags field if needed — for example, 'i' for case-insensitive matching or 'm' for multiline mode ('g' for global matching across all matches is applied automatically). Paste the text you want to test the pattern against into the test string box below. Click 'Test pattern' and every match found in your test string is highlighted inline, with a count of total matches shown above. If the pattern is invalid, the tool explains the syntax error so you can correct it. Adjust your pattern or flags and re-test as many times as needed until the highlighted matches line up with what you actually want to capture. Use the regex syntax reference at the bottom of the page as a refresher on common tokens like `\\d`, `\\w`, `+`, `*`, and `^`/`$` anchors while you build out more complex patterns.

Frequently asked questions

Does the tester show every match or just the first one?

It shows every match found in your test string, highlighted inline, along with a total match count.

What regex flavor does this tool use?

It uses standard JavaScript regular expression syntax, which covers the vast majority of patterns used in web development and general text matching.

What happens if my pattern has a syntax error?

The tool detects invalid patterns and shows the underlying syntax error message so you can fix it before testing again.

Is there help for someone new to regex syntax?

Yes, a reference table of common regex tokens and what they mean is included directly below the tester for quick lookups.

Related tools