Comment: match a body pattern alone on a line
^start of line
\g<body>calls group body as a subroutine
$end of line
Comment: we'll use (?<name>...){0} to define the pattern \g<name>
Comment: without having to match the pattern at the current position
Comment: a body pattern matches
Group body(?<body>
# a sequence of
(?: [^\[\]{}()\n] # non-delimiters
| \g<parens> # parenthesized pattern
| \g<square_brackets> # bracketed pattern
| \g<curly_braces> # braced pattern
)*
){0} {0}repeats the group contents below exactly 0 times:
Comment: a sequence of
Non-Capturing Group(?: [^\[\]{}()\n] # non-delimiters
| \g<parens> # parenthesized pattern
| \g<square_brackets> # bracketed pattern
| \g<curly_braces> # braced pattern
)* *repeats the group contents below any number of times:
1st Alternative [^\[\]{}()\n] # non-delimiters
Negated Character Class[^\[\]{}()\n] \[the literal [ (9110 / 1338 / 5B16)
\]the literal ] (9310 / 1358 / 5D16)
{the literal { (12310 / 1738 / 7B16)
}the literal } (12510 / 1758 / 7D16)
(the literal ( (4010 / 508 / 2816)
)the literal ) (4110 / 518 / 2916)
\na line-feed (newline) character (ASCII 10)
Comment: non-delimiters
2nd Alternative \g<parens> # parenthesized pattern
\g<parens>calls group parens as a subroutine
Comment: parenthesized pattern
3rd Alternative \g<square_brackets> # bracketed pattern
\g<square_brackets>calls group square_brackets as a subroutine
Comment: bracketed pattern
4th Alternative \g<curly_braces> # braced pattern
\g<curly_braces>calls group curly_braces as a subroutine
Comment: braced pattern
Comment: a parenthesized pattern matches
Group parens(?<parens>
\( # an open paren
\g<body> # a valid body
\) # a close paren
){0} {0}repeats the group contents below exactly 0 times:
\(the literal ( (4010 / 508 / 2816)
Comment: an open paren
\g<body>calls group body as a subroutine
Comment: a valid body
\)the literal ) (4110 / 518 / 2916)
Comment: a close paren
Comment: a bracketed pattern matches
Group square_brackets(?<square_brackets>
\[ # an open square bracket
\g<body> # a valid body
\] # a close square bracket
){0} {0}repeats the group contents below exactly 0 times:
\[the literal [ (9110 / 1338 / 5B16)
Comment: an open square bracket
\g<body>calls group body as a subroutine
Comment: a valid body
\]the literal ] (9310 / 1358 / 5D16)
Comment: a close square bracket
Comment: a braced pattern matches
Group curly_braces(?<curly_braces>
\{ # an open curly brace
\g<body> # a valid body
\} # a close curly brace
){0} {0}repeats the group contents below exactly 0 times:
\{the literal { (12310 / 1738 / 7B16)
Comment: an open curly brace
\g<body>calls group body as a subroutine
Comment: a valid body
\}the literal } (12510 / 1758 / 7D16)
Comment: a close curly brace
g modifier: global. Finds all matches instead of stopping after the first
m modifier: multiline. Causes ^ and $ to match the start and end of each line, not only the start and end of the string
x modifier: extended. Ignores unescaped whitespace and comments outside character classes