Regex Tester
Test regular expressions against real text.
//
Something went wrong
| # | Index | Match | Groups |
|---|
Processed locally in your browser. Nothing you type here is sent to our servers.
What does this tool do?
It runs a JavaScript regular expression against your test text and shows you exactly what matched: highlighted in context, and listed with each match's position and capture groups. Everything updates as you type, so you can build a pattern incrementally rather than guessing.
How to use it
- Type your pattern into the field between the slashes — no delimiters needed.
- Tick the flags you want; the full literal is shown beneath them.
- Paste your test text below, then watch the matches highlight as you type.
- Read the table for each match's position and captured groups.
The flags
- g — find every match rather than stopping at the first.
- i — case-insensitive matching.
- m —
^and$match at each line break, not just at the start and end of the whole string. - s —
.also matches newline characters, which it does not by default. - u — full Unicode mode, needed for
\p{...}property escapes and correct handling of characters outside the basic plane.
Capture groups
Anything in parentheses is captured and listed alongside its match. Named groups —
(?<year>\d{4}) — appear by name, which makes a long pattern far
easier to read later. Use (?:...) for a group you want to apply a
quantifier to but do not need to capture.
A group that takes part in no match shows as (no match) rather than being silently omitted.
Common use cases
- Building a validation pattern and checking it against genuine edge cases.
- Extracting fields from log lines or a text export.
- Working out why a pattern that looks right is matching nothing.
- Testing a search-and-replace before running it across a codebase.
Limitations
- This uses the JavaScript regex engine. PCRE, Python, Go (RE2) and Java differ in real ways — lookbehind support, atomic groups, recursion, named-group syntax. A pattern that works here may not work identically elsewhere.
- Results are capped at 1,000 matches, and the detail table shows the first 200, to keep the page responsive.
-
A catastrophically backtracking pattern such as
(a+)+$against a long non-matching string can lock the tab. This is inherent to backtracking engines, not to this page — and it is exactly why such patterns are a denial-of-service risk in production. - Zero-length matches are marked in the highlighted view but have no width, since there is nothing to highlight.
- Your pattern is compiled as a regular expression, never evaluated as code. No JavaScript you type here is executed.