Skip to content

Regex Explainer

Break a regular expression into pieces and explain what each one does in plain English.

Runs in your browserNo account neededFree
Loading tool…

Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.

How to use the regex explainer

  1. Paste the regular expression.
  2. Add its flags if it has any.
  3. Read the explanation piece by piece.

About this tool

Inheriting a regular expression someone else wrote is a common and unpleasant experience. This breaks one into its pieces and says what each does, in order, including the flags — which are easy to overlook and change the meaning of the whole pattern.

Distinctions that matter are called out specifically: greedy versus lazy quantifiers, capturing versus non-capturing groups, and lookahead versus lookbehind. Those four account for most of the confusion when a pattern nearly works.

Be clear about what this is. It explains each piece in the order it appears — a reading aid, not a parser. It will not tell you that two parts can never both match, or summarise the expression as a whole. It answers what each symbol is doing, which is usually the actual question.

Common uses

  • Understanding a pattern found in an existing codebase.
  • Learning regex syntax from real examples.
  • Checking a pattern does what its author claimed.

Frequently asked questions

What is the difference between greedy and lazy?
A greedy quantifier takes as much as it can and gives back only if it must. A lazy one, written with a trailing ?, takes as little as possible. It is the usual reason .* swallows too much.
What does (?: ) mean?
A group that is not captured. It groups the pattern for a quantifier or alternation without producing a numbered result.
Does this validate my pattern?
It reports a syntax error if the pattern will not compile, and warns about the nested-quantifier shape that risks catastrophic backtracking. It does not check whether the pattern matches what you intended.

Related tools