Definition Group(?(DEFINE)
(?P<table> # To match nested table tags
<table\b[^>]*>
(?:
(?!</?table\b[^>]*>).
|
(?&table)
)*
</table\s*>
)
(?P<paragraph> # To match nested p tags
<p\b[^>]*>
(?:
(?!</?p\b[^>]*>).
|
(?¶graph)
)*
</p\s*>
)
) Group table(?P<table> # To match nested table tags
<table\b[^>]*>
(?:
(?!</?table\b[^>]*>).
|
(?&table)
)*
</table\s*>
) Comment: To match nested table tags
<tablethe literal text <table (case insensitive) \ban ASCII word boundary
Negated Character Class[^>]* *matches any number of characters outside the set below:
>the literal > (6210 / 768 / 3E16)
Non-Capturing Group(?:
(?!</?table\b[^>]*>).
|
(?&table)
)* *repeats the group contents below any number of times:
1st Alternative
(?!</?table\b[^>]*>).
Negative Lookahead(?!</?table\b[^>]*>) <the literal < (6010 / 748 / 3C16)
/?optionally matches the literal / (4710 / 578 / 2F16)
tablethe literal text table (case insensitive) \ban ASCII word boundary
Negated Character Class[^>]* *matches any number of characters outside the set below:
>the literal > (6210 / 768 / 3E16)
>the literal > (6210 / 768 / 3E16)
.any character
2nd Alternative
(?&table)
(?&table)calls group table as a subroutine
</tablethe literal text </table (case insensitive) \s*any whitespace character, repeated any number of times
Group paragraph(?P<paragraph> # To match nested p tags
<p\b[^>]*>
(?:
(?!</?p\b[^>]*>).
|
(?¶graph)
)*
</p\s*>
) Comment: To match nested p tags
<pthe literal text <p (case insensitive) \ban ASCII word boundary
Negated Character Class[^>]* *matches any number of characters outside the set below:
>the literal > (6210 / 768 / 3E16)
Non-Capturing Group(?:
(?!</?p\b[^>]*>).
|
(?¶graph)
)* *repeats the group contents below any number of times:
1st Alternative
(?!</?p\b[^>]*>).
Negative Lookahead(?!</?p\b[^>]*>) <the literal < (6010 / 748 / 3C16)
/?optionally matches the literal / (4710 / 578 / 2F16)
pthe literal p (11210 / 1608 / 7016) (case insensitive)
\ban ASCII word boundary
Negated Character Class[^>]* *matches any number of characters outside the set below:
>the literal > (6210 / 768 / 3E16)
>the literal > (6210 / 768 / 3E16)
.any character
2nd Alternative
(?¶graph)
(?¶graph)calls group paragraph as a subroutine
</pthe literal text </p (case insensitive) \s*any whitespace character, repeated any number of times
(?&table)calls group table as a subroutine
(*SKIP)acts like (*PRUNE), but the next unanchored match attempt starts where (*SKIP) was reached instead of at the next subject character
(*FAIL)forces the current match attempt to fail at this position
Comment: Let's skip table tags