Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Parsing HTML with a regex is never a good option, but it's sometimes the only option.
 help



In the example from the article it certainly is an option. In Python you could either use a "soup" library or you could play around with a tool like https://www.w3.org/Tools/HTML-XML-utils/man1/hxpipe.html.

The more fundamental question for me is why the author didn't decide to make make code blocks non-breaking by default, or just add the class annotations when he writes the HTML?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: