Regex Tester

Enter a pattern, pick flags, paste your test string: the regex tester shows every match with its index, the contents of numbered and named capture groups and explains each part of the pattern in plain English. Matching uses your browser’s JavaScript engine (ECMAScript).

Enter it without the surrounding slashes, e.g. \d+ rather than /\d+/. The pattern is part of the link and can be shared – the test string is not.
Your inputs are saved in this browser only.

The text to search. It stays in your browser and is not included in the link.

Your text stays in your browser – it is not sent, not stored and not added to the address bar.

Result

Result
2 matches
Matches
No.IndexLengthMatch
121102026-09-27
245102026-10-15
Groups per match
No.GroupNameValue
11jahr2026
12monat09
13tag27
21jahr2026
22monat10
23tag15
Pattern explained
TokenMeaning
(?<jahr>start of group 1, named “jahr”
› \da digit 0–9
› {4}the preceding item exactly 4 times
)end of group
-the literal text “-”
(?<monat>start of group 2, named “monat”
› \da digit 0–9
› {2}the preceding item exactly 2 times
)end of group
-the literal text “-”
(?<tag>start of group 3, named “tag”
› \da digit 0–9
› {2}the preceding item exactly 2 times
)end of group
As a JavaScript literal
/(?<jahr>\d{4})-(?<monat>\d{2})-(?<tag>\d{2})/g

How it is calculated

This regex tester uses the JavaScript flavor of regular expressions as defined by the ECMA-262 standard and implemented by your browser. A pattern that works here works exactly the same in String.prototype.match, matchAll, replace and RegExp.prototype.test – in Chrome, Firefox, Safari and Node.js.

Reading the result

The flags

g finds all matches instead of just the first, i ignores case, m makes ^ and $ work per line, s lets the dot match line breaks. u treats emoji and other characters outside the Basic Multilingual Plane as one character and enables Unicode properties such as \p{L} (any letter, including é or ñ). v is the newer version of u with set operations like [\p{L}--[a-z]]; u and v can’t be combined. y (“sticky”) only finds matches that follow each other without gaps.

Protection against infinite loops and hangs

Patterns such as a* or \b can produce empty matches. Like JavaScript itself, the tester then advances by one character (a full code point with u/v), so there is no infinite loop. At most 1,000 matches are searched for.

The bigger danger is catastrophic backtracking (ReDoS): nested quantifiers like (a+)+$ try an exponential number of combinations on a string that doesn’t match – 30 characters can keep the engine busy for minutes. That’s why the search runs in a separate background thread and is stopped after 2 seconds; the page stays responsive. Avoid such patterns in your own code too, especially on user input.

Differences from other regex flavors

PCRE (PHP), Python, Java and .NET differ in the details: JavaScript has no possessive quantifiers (a++), no atomic groups and no \A or \Z anchors; \w only covers A–Z, a–z, 0–9 and the underscore – for accented letters use \p{L} with the u flag.

Your test string is not sent, not stored and not written into the link – only the pattern and the flags are.

Frequently asked questions

How do I test a regular expression?

Type the pattern without slashes into the top field, tick the flags you need and paste your text. All matches are highlighted in the text straight away and listed with their index; below that you see what each group captured.

Why doesn’t \w match accented letters?

In JavaScript, \w only stands for A–Z, a–z, 0–9 and _. For letters in any language, use \p{L} with the u flag, e.g. [\p{L}\d_]+ for a word such as “café”.

What is the difference between greedy and lazy?

Greedy quantifiers (*, +, {2,}) take as much text as possible, lazy ones with a trailing question mark (*?, +?) as little as possible. On “<b>x</b>”, <.+> matches the whole string, <.+?> only “<b>”.

How do I name a capture group?

Use (?<name>…). In code you read it via match.groups.name, in a replacement string with $<name>, and inside the pattern with the backreference \k<name>.

Why was my search stopped?

It took longer than 2 seconds – usually because of catastrophic backtracking with nested quantifiers such as (\w+)*. Simplify the pattern: don’t nest quantifiers, make alternatives unambiguous and anchor it with ^ and $.

Does the result also apply to PHP or Python?

For simple patterns it usually does, but it is only guaranteed for JavaScript. PHP (PCRE) and Python support extra syntax such as possessive quantifiers or \A, and Python traditionally writes named groups as (?P<name>…).

Sources and legal basis

As of:

Related tools