Explain a regular expression in English

Explain each token, group, quantifier, and assertion in a JavaScript regular expression.

freeworks offlinenothing uploaded
ToolRegex Explainer
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The expression is tokenized into literals, character classes, groups, quantifiers, assertions, and alternations; each token is described with its matching scope. The explanation follows JavaScript syntax and does not execute replacement code.

  • JavaScript syntax is a common browser baseline.
  • Flags are shown separately because they alter matching behavior.

Worked example

Explain email validation regex in plain English
Get a plain English explanation of an email validation regex
Input
											^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
										
Output
												Pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/

This regex matches: at the start of the string, then any character in [a-zA-Z0-9._%+-], then repeated one or more times, then the character '@', then any character in [a-zA-Z0-9.-], then repeated one or more times, then the literal character '.', then any character in [a-zA-Z], then repeated 2 or more times, then at the end of the string
											

When to use this

Validation docs, code reviews, and support debugging explain regex tokens.

Edge cases

  • A greedy quantifier can consume text needed by a later group.
  • A hyphen in a character class changes meaning by position.
  • Escapes differ between regex literals and string constructors.

References