Skip to content

Regex Tester

Write a pattern, paste some text and see every match highlighted, with its position and capture groups.

Processed locally in your browser

Options

g global · i ignore case · m multiline · s dotAll · u unicode · y sticky · d indices

Runs in a background worker with a 5-second limit. Pattern limit: 2,000 characters; up to 10,000 matches.0 chars · 0 lines
The result will appear here.

What is Regex Tester?

A regular expression (regex) describes a text pattern: digits, words, dates, e-mail addresses. The Regex Tester runs your pattern against a test text using the JavaScript RegExp engine and shows each match highlighted in the text, plus a table with its index, the matched text and every numbered or named group.

Set the flags you need (g global, i ignore case, m multiline, s dotAll, u unicode, y sticky, d indices) and see the number of matches and the execution time. The pattern runs in a background worker that is stopped after 5 seconds, patterns are limited to 2,000 characters, at most 10,000 matches are returned, and patterns prone to catastrophic backtracking are refused with a clear message instead of freezing the page.

How does it work?

  1. Type your pattern in the pattern field and set the flags (g by default).
  2. Paste the text to test in the input box; matches are highlighted instantly.
  3. Read the match table for indexes and capture groups, then adjust the pattern until it matches exactly what you want.

Common use cases

  • Building and debugging a validation pattern for e-mails, phone numbers or IDs.
  • Checking what a capture group or named group actually captures.
  • Understanding why a pattern matches too much or too little (greedy versus lazy).
  • Verifying a pattern on real log lines before using it in code or a search tool.

Examples

Try this input in the tool above:

Contact: alice@example.com, bob@test.org
Dates: 2024-01-15 and 2023-12-31

Privacy

Regex Tester runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

This tester uses the JavaScript engine. PCRE, Python or .NET features such as possessive quantifiers or inline modifiers may not be supported or may behave differently.

Frequently asked questions

Which regex flavor does it use?

The JavaScript (ECMAScript) flavor of your own browser, including named groups, lookbehind and Unicode property escapes with the u flag.

Why was my pattern rejected as catastrophic?

Nested repetition such as (a+)+$ can take exponential time on some inputs. Rewrite it as a+$ or make the inner part unambiguous.

Why do I only get one match?

Without the g (global) flag a regex returns only the first match. Add g to the flags to find them all.

More tools in Developer Tools →