Skip to content

Regex explainer

Read common regular-expression tokens as plain language and export a compact explanation without running a pattern.

Pattern reading19 chars
This reads tokens; it does not run the pattern.
Live token explanation Ready
^start of input or line (with m)
\da decimal digit
{4}repeat the previous token this many times
-the literal character “-”
\da decimal digit
{2}repeat the previous token this many times
-the literal character “-”
\da decimal digit
{2}repeat the previous token this many times
$end of input or line (with m)
Processed on your device

How it works & useful details

Read a pattern token by token

This explainer describes common anchors, escapes, character classes, groups, alternatives, and quantifiers. It reads the pattern as text; it does not compile or execute it.

The explanation is a compact learning aid, not a complete parser or a proof that a pattern is valid, safe, or equivalent across regex engines.

Private, bounded text processing

Code and markup stay as inert text in this browser. These tools do not execute JavaScript, render HTML, load URLs, install packages, contact registries, or save what you paste.

Regex patterns are limited to 500 characters and test text to 20,000 characters. Formatters and package inspection accept up to 100,000 characters; exports are capped at 200,000 characters.

About this tool

Regex explainer reads a regular expression token by token and describes what each part does in plain language. It is a learning and review aid for patterns you did not write yourself or wrote too long ago to remember.

The pattern is only analyzed as text; it is never executed against input. The explanation is exported as compact text you can paste next to the pattern in code comments or documentation.

How to use it

  1. Paste the regular expression (without delimiters) into the input.
  2. Review the token-by-token explanation, including character classes and quantifiers.
  3. Note any tokens the explainer reports as unsupported.
  4. Copy the explanation for comments, docs, or a review.

Worked example

The pattern ^\d{4}-\d{2}-\d{2}$ is explained token by token:

^      start of input or line (with m)
\d     a decimal digit
{4}    repeat the previous token this many times
-      the literal character "-"
\d{2}  two digits
-      the literal character "-"
\d{2}  two digits
$      end of input or line (with m)

Together, it matches an ISO-style date such as 2026-09-24, and nothing before or after it. It also accepts 2026-19-99, because regular expressions check shape, not meaning. Validate the actual date in code.

Common tokens at a glance

  • \d digit, \w word character (letter, digit, underscore), \s whitespace, . any character except a line break.
  • * zero or more, + one or more, ? optional, {n,m} between n and m times. Add ? to make them lazy, as in .*?.
  • [abc] one of these characters, [^abc] any character except these, [a-z] a range.
  • ( ) capture group, (?: ) non-capturing group, (?<name> ) named group, a|b alternatives.
  • ^ and $ anchor the start and end, \b marks a word boundary.

The explainer reads the pattern as text and never runs it, so you can safely inspect patterns from configuration files, log filters, or code reviews.

Frequently asked questions

Does it run the pattern or test matches?

No. Explaining a pattern is separate from testing it; use the regex tester to run a match against sample text.

Which regex flavor is described?

The explanation follows JavaScript regular-expression syntax. Patterns from other engines may use constructs it reports as unsupported.

What is the limit?

Patterns are limited to 500 characters.

Does it tell me whether a regex is correct?

It explains what each token means. To see what a pattern actually matches, run it against sample text in the regex tester.