Regex Tester

Test regular expressions with real-time matching

/ /

No matches found

What is Regex Tester?

The Regex Tester is a free online tool that lets you build and test regular expressions against real text with instant, highlighted results. A regular expression, or regex, is a compact pattern for finding, matching, and extracting text, but the syntax is notoriously easy to get wrong. This tool shows every match highlighted directly in your test string, lists both the numbered and named capture groups for each match, and supports every JavaScript flag — global, case-insensitive, multiline, dot-matches-all, unicode, and sticky. A built-in replace mode lets you preview the result of a substitution using $1 and $<name> references, and a sixteen-pattern library covers emails, URLs, IPv4 and IPv6 addresses, phone numbers, dates, times, hex colors, slugs, usernames, strong passwords, credit cards, ZIP codes, UUIDs, HTML tags, and whitespace. Everything runs in your browser, so your patterns and test data stay private.

How to use Regex Tester?

Testing a pattern takes only a moment and happens entirely in your browser:

  1. 1 Type your regular expression into the pattern field, then toggle any of the six flags you need — g global, i case-insensitive, m multiline, s dot-matches-all, u unicode, and y sticky.
  2. 2 Paste or type the text you want to test against in the test-string area. The tool evaluates your pattern continuously as you edit either field.
  3. 3 Watch matches appear highlighted in real time directly within your test text, so you can see exactly what the pattern captures and what it misses.
  4. 4 Review the match details below, where each numbered and named capture group is listed separately along with its position; or turn on replace mode to preview a substitution before you commit it to code.

Why use this tool?

Regular expressions are one of the most powerful tools a developer has, but a small mistake can silently match too much or nothing at all. Testing against real data with live highlighting removes the guesswork, letting you refine a pattern until it behaves exactly as intended before you drop it into code. This is invaluable for validating form input, parsing logs, extracting fields from text, and search-and-replace operations. Seeing numbered and named capture groups separately confirms you are pulling out the right pieces, while replace mode shows the exact output of a substitution. Because the tool runs entirely in your browser with a sixteen-pattern library and no signup, you can experiment freely and privately as much as you like.

Examples

Validating an email address

Load the built-in email pattern and test it against a list of addresses to instantly see which ones match and which fail your validation rule.

Extracting named capture groups

Write a pattern such as (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) against a date and see each group listed by name as well as by number.

Previewing a replacement

Turn on replace mode, match (\w+)@(\w+) and type $2.$1 as the replacement to preview swapping the parts of every match.

Frequently Asked Questions

Is the Regex Tester free to use?

Yes. The tool is completely free, with no signup, no limits, and no account required. You can test as many patterns as you like.

Is my pattern or test text sent to a server?

No. All matching happens entirely in your browser, so your patterns and test data are never uploaded or stored anywhere.

Which flags can I toggle?

All six JavaScript flags are supported: g global, i case-insensitive, m multiline, s dot-matches-all, u unicode, and y sticky. You can toggle them with checkboxes or type them directly into the flags box.

How does replace mode work?

Enable replace mode and enter a replacement string. The tool runs a substitution and shows the result, supporting numbered references like $1 and named references like $<name>.

What are capture groups?

Capture groups are the parts of a pattern wrapped in parentheses. They let you extract specific portions of each match, and the tool lists both numbered and named groups separately so you can verify your pattern.

Which regex flavor does the tool use?

It uses the JavaScript regular expression engine that runs in your browser, so the syntax and behavior match what you would use in front-end and Node.js code.