toolqik

116 · Format & Test

Regex Explainer

Paste a regular expression and get a plain-English, step-by-step explanation.

Runs in your browser

      About this tool

      Regular expressions are compact and powerful, and nearly unreadable a week after you wrote them. Paste any regex here (from code, Stack Overflow or a config file) and get a breakdown of every part in plain English, indented to show how groups nest. It also checks the pattern: if it isn’t valid, you see the browser’s error message.

      What it explains

      • Literal text, merged into readable runs (“Matches the text ‘price: $’”).
      • Character classes like [A-Za-z0-9_], negated classes, and shorthands \d, \w, \s and Unicode properties such as \p{L}.
      • Quantifiers *, +, ?, {n,m}, including whether they are greedy or lazy.
      • Groups: capturing, named ((?<year>…)), non-capturing, and alternatives with |.
      • Lookarounds (?=…), (?!…), (?<=…), (?<!…), back-references \1 and \k<name>.
      • Anchors and boundaries ^, $, \b, and how the m and s flags change them.
      • Flags: g, i, m, s, u, v, y and d.

      Regex flavours

      Explanations follow JavaScript’s regex syntax, which is very close to PCRE (PHP), Python’s re, Java and .NET for everyday patterns. Some features differ: possessive quantifiers (a++) and atomic groups exist in PCRE and Java but not JavaScript; Python writes named groups as (?P<name>…). If a pattern from another language is rejected, that’s usually why.

      Once you understand the pattern, try it on real text in the regex tester (the button above opens it with your pattern), or create a new one from examples with the regex generator.

      FAQ

      How do I understand a regular expression?

      Paste it into the box. Each part is listed with a plain-English explanation, indented to show nesting, plus what each flag does.

      Can I paste a regex with slashes, like /abc/gi?

      Yes. A /pattern/flags literal is split into the pattern and flags automatically.

      What does (?: ) mean in a regex?

      A non-capturing group: it groups parts of the pattern (for example to repeat them or to use |) without saving the match as a numbered group.

      What is the difference between greedy and lazy quantifiers?

      Greedy quantifiers (*, +) match as much as possible; lazy ones (*?, +?) match as little as possible. In "<a><b>", <.+> matches the whole string while <.+?> matches just <a>.

      Which regex flavour is used?

      JavaScript. It is close to PCRE, Python and Java for common patterns, but a few features such as possessive quantifiers are not supported.

      esc
      ↑↓ navigate↵ open