Regex Explainer

Break a regular expression down into a plain-English explanation of every token, group, quantifier and flag.

With or without the slashes. Read as JavaScript (ECMA-262 §22.2) syntax.

Flags
Examples:

Plain-English breakdown

    Flags in use

      Regex token cheat sheet
      .
      any character except a line break
      \d \w \s
      digit, word character, whitespace
      \D \W \S
      the negated versions of the above
      [abc] [^abc]
      one of / none of these characters
      a* a+ a?
      zero or more, one or more, optional
      a{2,4}
      between 2 and 4 times
      a+?
      lazy quantifier, matches as little as possible
      ^ $
      start / end of the string (or of a line with m)
      \b \B
      word boundary / not a word boundary
      (abc)
      capturing group, read back as $1
      (?<year>\d{4})
      named capturing group
      (?:abc)
      group without capturing
      \1 \k<year>
      back-reference to an earlier group
      (?=abc) (?!abc)
      positive / negative lookahead
      (?<=abc) (?<!abc)
      positive / negative lookbehind
      \p{L}
      Unicode property escape (needs the u flag)
      No uploads. Your files stay on your device.

      Free forever, no sign-up, no cookies. Buy me a coffee

      How it works

      Paste a regular expression and this page takes it apart token by token, describing every piece in ordinary English: which parts are anchors, which are character classes, what each quantifier repeats, which groups capture and what number or name they will be read back under. The breakdown is a nested outline that mirrors the structure of the pattern, so a group inside an alternation inside a lookahead reads as three indented levels instead of one wall of punctuation.

      The parser is hand-written against the ECMAScript pattern grammar in ECMA-262 §22.2, the same grammar your browser and Node use, and the pattern is compiled with new RegExp first so an invalid expression shows the engine's own error message instead of a guess. Flags change the wording: with s the dot is described as also matching line breaks, and with m the ^ and $ anchors are described as matching at every line break. The "things to watch" list points out nested open-ended quantifiers (the classic catastrophic-backtracking shape), a literal dot inside a character class, and the lastIndex behaviour of the g flag.

      Everything happens in your browser: the pattern is never uploaded, so it is safe to explain expressions taken straight from production code or from a log-scrubbing rule. Copy the outline as plain text or download it as a .txt file to drop into a code comment or a pull-request description.

      Frequently asked questions

      What does this regex mean?

      Paste the pattern into the box and the page answers that question line by line. It reads the expression with a parser written against the ECMAScript grammar in ECMA-262 section 22.2 and prints a nested outline: each anchor, character class, quantifier, group and back-reference gets its own row with the exact snippet it came from and a sentence describing what it does. A group inside an alternation inside a lookahead is shown as three indented levels, so the structure is visible rather than buried in punctuation.

      Which regular expression flavour does the explainer understand?

      JavaScript, also called ECMAScript. That covers the g, i, m, s, u and y flags, named capturing groups, back-references, lookahead and lookbehind, Unicode property escapes and lazy quantifiers. Flags change the wording: with the s flag the dot is described as matching line breaks too, and with the m flag the caret and dollar are described as matching at every line break. Patterns are compiled with new RegExp first, so an invalid one shows the browser engine's own error message instead of a guess. PCRE-only syntax such as atomic groups or recursion is not supported.

      Is my regex sent anywhere?

      No. There is no API call and no AI service behind this page: the parser runs in your browser, so the pattern never leaves your device. That makes it safe to explain an expression copied straight out of production code, a log-scrubbing rule or a validation library. There is no signup and no upload, and you can copy the explanation as plain text or download it as a .txt file to paste into a code comment or a pull request.

      Report a bug