r/ProgrammerHumor • • Sep 08 '17

Parsing HTML Using Regular Expressions

Post image
11k Upvotes

377 comments sorted by

View all comments

Show parent comment

1

u/link23 Sep 09 '17

That's not the point - we're talking about theory, not practice. Even if you had infinite time and had a machine that could perform any regex match, no matter how large, it's still not possible. A regular expression cannot hold enough information to express the constraints of HTML. (The real kicker is matching nested tags - it's not possible to enforce that every tag is closed properly if it should be.)