4 ms·
I do it often, partly to troll people who religiously claim I must not. When I extract stuff from HTML with regex I don't really care about reliability, robustn
by inshadows 6y ago
I do it often, partly to troll people who religiously claim I must not. When I extract stuff from HTML with regex I don't really care about reliability, robustness, interface design, encapsulation, separation of concerns, etc. I just want that damn string and be done with it, and what's easier than curl | sed pipeline?
EDIT: OK, the article actually talks about parsing the tree. I meant just extracting some strings.
- perl4ever 6y agoI made an anti-regex comment ( https://news.ycombinator.com/item?id=26310559 https://news.ycombinator.com/item?id=26310559) a few days ago that could be misconstrued as inviting this sort of response. But I was talking about XML in files used for data interchange that were sometimes a gigabyte or two. There's a link in the stackoverflow thread to a purported XML parser using regexes at https://www2.cs.sfu.ca/~cameron/REX.html#IV.3 https://www2.cs.sfu.ca/~cameron/REX.html#IV.3 Looking at the CDATA section, I think it's an example of the sort of pitfalls you run into. He thinks you can put "arbitrary content" in it, but that's a pet peeve of mine; it's not so. I once got a file to ingest that made that mistake, so I'm sure he isn't the only one.