News for hackers. Stuff that matters.
Re:Learn to use Awk with hundreds of examples by johnnylambada on Wednesday October 25, 2017 @10:23AM (#15550328)
While we're on the subject, let's not forget to avoid parsing HTML with regex: https://stackoverflow.com/questions/1732348/regex-match-open...
Re:Learn to use Awk with hundreds of examples by ams6110 on Wednesday October 25, 2017 @11:01AM (#15550669)
Generally good advice, but can be OK in specific situations where you have a known HTML structure and are just scraping some values out of it. This is not so much parsing HTML as it is matching the patterns of the values you want to extract.
Re:Learn to use Awk with hundreds of examples by johnnylambada on Wednesday October 25, 2017 @12:19PM (#15551461)
the pon̷y he comes he c̶̮omes
Re:Learn to use Awk with hundreds of examples by jdnier on Wednesday October 25, 2017 @02:18PM (#15552640)
A regex can be used effectively to tokenize XML-like markup, including a lot of HTML—sometimes called shallow parsing. https://stackoverflow.com/a/6638578/234823

Attribute value minimization would be one limitation, since that regex is for XML, but it's a more robust approach than writing naive "<x>.*</x>"-style regexes.

Re:Learn to use Awk with hundreds of examples by AceJohnny2 on Wednesday October 25, 2017 @03:33PM (#15553346)
> A regex can be used effectively to tokenize XML-like markup

...isn't that how all tokenizers for all (confusingly-named) context-free languages work?