Skip to content

Regex Tester

Test a pattern, and read what it actually says in English.

Test a regular expression against your own text with live highlighting and capture groups, and get a token-by-token explanation of what the pattern means.

Written and maintained by Mohit PatelLast checked August 4, 2026How we build these

3 matches

Due 2026-08-15, invoiced 2026-07-31, paid 2026-08-02.

Capture groups for each match
AtMatchGroups
42026-08-151=20262=083=15year=2026month=08day=15
252026-07-311=20262=073=31year=2026month=07day=31
422026-08-021=20262=083=02year=2026month=08day=02

After replacing

Due 15/08/2026, invoiced 31/07/2026, paid 02/08/2026.

What this pattern says

  1. (?<year>the start of capture group 1, named "year"
  2. \dany digit, 0 to 9
  3. {4}exactly 4 times, as many as possible (greedy)
  4. )the end of the group
  5. -the character "-"
  6. (?<month>the start of capture group 2, named "month"
  7. \dany digit, 0 to 9
  8. {2}exactly 2 times, as many as possible (greedy)
  9. )the end of the group
  10. -the character "-"
  11. (?<day>the start of capture group 3, named "day"
  12. \dany digit, 0 to 9
  13. {2}exactly 2 times, as many as possible (greedy)
  14. )the end of the group

Patterns worth stealing

Starting points rather than finished answers. The email pattern in particular is the pragmatic one, not the one that follows RFC 5322, which runs to several thousand characters and still accepts addresses no mail server will deliver to.

Everything runs in this browser with JavaScript’s own engine, so what you see is exactly what your code will do — including the differences from PCRE, Python and Go, which have their own lookbehind rules and their own ideas about what \b means outside ASCII. Nothing is sent anywhere, which matters when the text you are testing against is a log file or a customer record.

How the Regex Tester works

Testing is the easy half. The usual reason anybody opens a regex tester is that they were handed a pattern and do not fully understand it, so every token is broken out and explained, and every quantifier says whether it is greedy or lazy — which is the answer to most of the questions that bring people here.

Also known as: regular expression tester · regex explainer · regex online tester · javascript regex tester · regex match checker

Frequently asked questions

What is the difference between a greedy and a lazy quantifier?

A greedy quantifier takes as much as it can and gives characters back only when the rest of the pattern fails; a lazy one, written with a question mark after it, takes as little as it can and adds more only when it has to. It is why <.*> matches an entire line of HTML from the first tag to the last, while <.*?> matches one tag. Every quantifier here says which it is, because it is the single most common source of a pattern that almost works.

What is catastrophic backtracking?

When a quantifier is applied to something already quantified, such as (a+)+, the engine can try an exponential number of ways to divide the input. On a string that nearly matches but does not, a pattern like that will hang rather than return, which is the mechanism behind most regular expression denial of service. The classic shapes are flagged here, though the general question cannot be settled by inspection, so a pattern that passes can still be slow.

What is the difference between a capturing and a non-capturing group?

Both group things together so a quantifier or an alternation applies to the whole lot. A capturing group also remembers what it matched, so you can refer to it as $1 in a replacement or as \1 later in the pattern. A non-capturing group, written (?:...), does the grouping without the bookkeeping, which keeps the numbering of the groups you do care about from shifting every time you add a pair of brackets.

Does this match how regex works in Python or PCRE?

Not exactly. This runs JavaScript's own engine, so what you see is precisely what your JavaScript will do. Python, PCRE, Go and Java differ on lookbehind, on what a word boundary means outside ASCII, on named group syntax and on whether the engine backtracks at all — Go's RE2 does not, which is why it refuses backreferences. A pattern that works here is a good starting point elsewhere rather than a guarantee.

Why does my email pattern reject a valid address?

Because almost every email pattern in circulation, including the one offered here, is a pragmatic approximation. The pattern that actually implements RFC 5322 runs to several thousand characters, and it still accepts addresses that no mail server will deliver to, since whether a mailbox exists is not a question syntax can answer. Rejecting anything without an @ and a dot after it catches typos; anything stricter starts rejecting real people.

Is my test data sent anywhere?

No. The pattern and the text are matched in your browser and nothing leaves the page, which matters when what you are testing against is a log file, a customer list or anything else you would not paste into a stranger's server.

Related calculators