i would like to get in a text all opened and closed html tag.
I mean with this pattern: <[a-z]+>
and </[a-z]+>
(without considering tag with number or any attribute or any xhtml self closed tag)
I mean using 2 preg_match_all to get em both:
preg_match_all( '#<([a-z]+)>#i' , $html, $start, PREG_OFFSET_CAPTURE );
preg_match_all( '#<\/([a-z]+)>#i' , $html, $end, PREG_OFFSET_CAPTURE );
the first will put any tags within array $start
and the second within $end
.
Is there a way to get em using only single instance of preg_match_all
? (I think with only 1 preg the function will be much faster)
Thanks