News for hackers. Stuff that matters.
Re:You can't parse XML with regex. Let's do it anyways by bazoom42 on Sunday October 05, 2025 @04:14PM (#45484813)
It completely misses the point of the question though.

The question is not asking about parsing in the sense of matching start tags with end tags, which is indeed not possible with a regex.

The question is about lexing, for which regex is the ideal tool. The solution is somewhat more complex than the question suggest since you have to exclude tags embedded in comments or CDATA sections, but it is definitely doable using a regex.

There are no comments on this comment yet.