3 ms·
Oh come on, it's not crapping on a newbie. It's a funny comment that serves as a reflection of the days and weeks this guy spent debugging these kinds of system
by underdeserver 3y ago
Oh come on, it's not crapping on a newbie. It's a funny comment that serves as a reflection of the days and weeks this guy spent debugging these kinds of systems.
As someone who was a newbie at the time when it was posted, who was looking for a way to parse HTML, I took away that it's just really the wrong way to go about it. I didn't feel crapped on at all.
- stavros 3y agoThe question isn't looking to parse HTML (or XML). Regexes are inappropriate for HTML because they can't adequately match the starting and ending tags, not because of black magic. The OP isn't looking to do that, so regexes look like a perfectly acceptable way to go.
- underdeserver 3y agoI agree completely. But the asker is very clearly a newbie. The question does not contain further context. The asker's suggestion is wrong (I think). And we've all worked with junior engineers who try to use the wrong tool. The answer is a whimsical way of making an appropriate suggestion in this inferred context. Also, to be fair, I think it's not mathematically impossible to use dark regex magic (with look-behinds and such) to parse HTML, but that's a discussion for another day...
- bazoom42 3y agoThe question is about tokenizing XHTML, not parsing it into a tree structure like a DOM, which is a critical distinction. Regular expressions are a perfectly valid way to tokenize. This is why the snarky answers does not suggest a better solution - there isnt one! If you scroll down long enough, you will see answers explaining that. But they arent upvoted as the answers suggesting the questioner is an idiot.