I researched this quite a bit, but couldn\'t find a working example how to match nested html tags with attributes. I know it is possible to match balanced/neste
Matching innermost matching pairs of
tags, plus their attributes & content:
#
The key here is that (?:(?!STRING).)*
is to strings as [^CHAR]*
is to characters.
Credit: https://stackoverflow.com/a/6996274
Example in PHP:
in 1
in 2
in 3
Outputs:
************
in 3
************
in 5