Group code_start(?<code_start>
[ ]{0,3} # Possibly up to 3 leading spaces
(?:
(?<with_backtick>[`]{3,}) # 3 code marks (backticks) or more
|
(?<with_tilde>[~]{3,}) # or 3 code marks (tilde) or more
)
) {0,3}matches between 0 and 3 characters from the set below:
the literal (3210 / 408 / 2016)
Comment: Possibly up to 3 leading spaces
Non-Capturing Group(?:
(?<with_backtick>[`]{3,}) # 3 code marks (backticks) or more
|
(?<with_tilde>[~]{3,}) # or 3 code marks (tilde) or more
) 1st Alternative
(?<with_backtick>[`]{3,}) # 3 code marks (backticks) or more
Group with_backtick(?<with_backtick>[`]{3,}) {3,}matches at least 3 characters from the set below:
`the literal ` (9610 / 1408 / 6016)
Comment: 3 code marks (backticks) or more
2nd Alternative
(?<with_tilde>[~]{3,}) # or 3 code marks (tilde) or more
Group with_tilde(?<with_tilde>[~]{3,}) {3,}matches at least 3 characters from the set below:
~the literal ~ (12610 / 1768 / 7E16)
Comment: or 3 code marks (tilde) or more
*matches any number of characters from the set below:
the literal (3210 / 408 / 2016)
\ta tab character (ASCII 9)
Condition(?(<with_tilde>)
(?:
(?:
(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
)
|
(?:
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)
)?
)
|
(?:
(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
)
|
(?:
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)
)
) Uses the first branch if group with_tilde matched
If the condition is true, match this branch:
(?:
(?:
(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
)
|
(?:
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)
)?
)
Non-Capturing Group(?:
(?:
(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
)
|
(?:
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)
)?
) Non-Capturing Group(?:
(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
)
|
(?:
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)
)? ?repeats the group contents below at most once:
1st Alternative
(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
)
Non-Capturing Group(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
) Group code_class(?<code_class>(?&_code_class)) (?&_code_class)calls group _code_class as a subroutine
Non-Capturing Group(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)? ?repeats the group contents below at most once:
*matches any number of characters from the set below:
the literal (3210 / 408 / 2016)
\ta tab character (ASCII 9)
\{the literal { (12310 / 1738 / 7B16)
Character Class[[:blank:]\h]* Group code_attr(?<code_attr>(?&_code_attr)) Character Class[[:blank:]\h]* \}the literal } (12510 / 1758 / 7D16)
2nd Alternative
(?:
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)
Otherwise, match this branch:
(?:
(?:
(?<code_class>(?&_code_class))
(?:
[ \t]*
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)?
)
|
(?:
\{[[:blank:]\h]*(?<code_attr>(?&_code_attr))[[:blank:]\h]*\}
)
)
\n+a line-feed (newline) character (ASCII 10), repeated at least once
Group code_content(?<code_content>.*?) Comment: enclosed content
\n+a line-feed (newline) character (ASCII 10), repeated at least once
Negative Lookbehind(?<!`) \g{code_start}the text saved by group code_start
Comment: balanced closing block marks
Comment: possibly followed by some space
Non-Capturing Group(?:\n|\Z) Comment: contrary to the vanilla version, we allow for no double line-break