It doesn’t handle self-closing tags, but that’s not the point. It would be trivial to add that, but again, that’s not the point.
The point is that you probably don’t want to do this with regular expressions, even though, contrary to popular opinion, you pretty much can. The article even calls the solution “slow and overspecified, but still kinda neat”.