Is there a way of finding the matching/closing X/HTML tag, given an opening tag? How about selecting the contents of an X/HTML tag?
Howto find matching HTML tag?
(4 posts) (3 voices)-
Posted 3 years ago #
-
IMO, the answer is no. Take an example:
<b><b><c><b>.....</b></c></b></b>If you want to find the second matching <b> tag (which is repeated in this example), you have to count the number of <b> tags (which is three in this example) and use this number (2) to find the second </b> tags after this <b>.
As it's not possible to count using regex, the answer is no.
Posted 3 years ago # -
This would be a fairly simple thing to do with a python script, and would be nice for inclusion in future PN as well.
Posted 3 years ago # -
OK - thanks for the replies
Posted 3 years ago #
Reply
You must log in to post.