Regex Tester
Write a pattern, paste some text and see every match highlighted, with its position and capture groups.
Processed locally in your browser· Your data stays in your browser.
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?
- Type your pattern in the pattern field and set the flags (g by default).
- Paste the text to test in the input box; matches are highlighted instantly.
- 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.
Related tools
Regex Match Extractor
Pull every piece of text that matches a pattern out of a long document and get it as a tidy list.
Developer Tools
Regex Replace
Rewrite text with a regex pattern and a replacement template that can reuse the captured pieces.
Developer Tools
Regex Escape
Turn any literal text into a safe regex pattern by escaping the characters that have a special meaning, or reverse it.
Developer Tools
Find and Replace
Search a block of text and replace every occurrence, as plain text or with a regular expression and capture groups.
Text Tools
JSONPath Finder
Type a JSONPath expression and instantly see the values it selects in your JSON, together with the normalized path of each match.
JSON & Data
Text Analyzer
A one-stop inspector for any string: size, character statistics, cryptographic digests and the raw bytes behind it.
Text Tools
URL Parser
Paste a URL and see every component separately, with the query parameters decoded in a table.
Developer Tools