Re:Is there a regular expression to detect a valid regular e...
by hk__2 on Monday September 09, 2019 @03:53AM
(#20916055)
> Yes you can tokenize this with a regular expression and extract the valid start and end tags.
So you need more than a regular expression, hence your premise is incorrect.
Re:Is there a regular expression to detect a valid regular e...
by unlinkr on Monday September 09, 2019 @04:52AM
(#20916334)
No, you don't need more than a regular expression. If you want to extract elements, i.e. match start tags to the corresponding end tags, then you need a stack-based parser. But just to extract the start tags (which is the question) a regular expression is sufficient.
The original question is a question about tokenization, not parsing, which is why a regular expression is sufficient.
If comments in XHTML could nest you would have a problem. But this is not the case.