Timeline for Regex and HTML - The long tail annoys me
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:37 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Mar 20, 2017 at 10:32 | history | edited | CommunityBot |
replaced http://meta.stackexchange.com/ with https://meta.stackexchange.com/
|
|
Jul 3, 2014 at 9:25 | comment | added | hek2mgl | You failed to realize that the questions on SO are mostly just examples, targeting a small piece of an application. In real world regexes are really fragile against updates of the incoming format, and HARD to maintain. Would you like to get overhanded a project where developers parse all that html with regexes or would you like a simple to read DOM parser code?. Also in real world scenarios it is likely that multiple values should be extracted from the document, would you say it is not a overhead to run a regex every time over the whole document? | |
Apr 27, 2014 at 19:09 | history | migrated | from meta.stackexchange.com (revisions) | ||
Sep 3, 2011 at 8:04 | comment | added | Kobi |
I disagree with some of that. Most question come from people who don't know the right tool, and they should be pointed in the right direction. However, I would always include working code in the answer. It usually amount to 3 lines of code, and it is much better than "parroting", as you say, "you can't use a parser". (I used "duckspeak" before, but I may overdid it :) )
|
|
Sep 3, 2011 at 6:36 | comment | added | Pekka | Pure pattern matching may work for the HTML example the OP shows, but will fail for the real-world case the next day where the attributes are in different order, are in uppercase or lowercase, tags are self-closing... That's why I say it's still true that if the OP isn't in it for the learning, "use a HTML parser" is still the Correct Answer™. | |
Sep 3, 2011 at 6:34 | comment | added | Pekka |
I think comparing recommending a HTML parser to recommending jQuery is utterly ridiculous. As Tchrist says in his epic answer on parsing HTML with regex: Sure, it isn’t easy, but it is possible! ... And trying to do so is a terrible waste of time, because good parsing classes exist which you should use for this task.
|
|
Sep 2, 2011 at 22:49 | comment | added | genesis | you're my guy.. I sometimes (when I really don't know javascript solution (everything's much simplier in jQuery)) suggest user to use jQuery, but I at least provide code to DO so | |
Sep 2, 2011 at 22:45 | history | answered | NullUserException | CC BY-SA 3.0 |