5 ms·
The very popular Zalgo answer is a perfect example of this problem [1] The user asks a question that can be answered quite easily, and dozens of people post an
by newaccount74 3y ago
The very popular Zalgo answer is a perfect example of this problem [1]
The user asks a question that can be answered quite easily, and dozens of people post answers claiming that this is the wrong way to do it and that they should use some other tech to solve the problem.
Some people on Stack Overflow care more about showing off how smart they are rather than answering questions, and I think the point system attracts these people.
[1]: https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags#1732454 https://stackoverflow.com/questions/1732348/regex-match-open...
- cowthulhu 3y agoHilariously, the accepted (I assume by default, not by the asker) answer is flagrantly breaking, like, half a dozen rules and guidelines… but because it’s cynically and unhelpfully crapping on a newbie, it stays up. Or maybe there’s a good reason for it to stay up, but at a glance it sure isn’t a good look. I actually think SO is a great site and resource, but I also think a lot of that is despite the bitter old timers in the community, not because of them.
- underdeserver 3y agoOh come on, it's not crapping on a newbie. It's a funny comment that serves as a reflection of the days and weeks this guy spent debugging these kinds of systems. As someone who was a newbie at the time when it was posted, who was looking for a way to parse HTML, I took away that it's just really the wrong way to go about it. I didn't feel crapped on at all.
- stavros 3y agoThe question isn't looking to parse HTML (or XML). Regexes are inappropriate for HTML because they can't adequately match the starting and ending tags, not because of black magic. The OP isn't looking to do that, so regexes look like a perfectly acceptable way to go.
- underdeserver 3y agoI agree completely. But the asker is very clearly a newbie. The question does not contain further context. The asker's suggestion is wrong (I think). And we've all worked with junior engineers who try to use the wrong tool. The answer is a whimsical way of making an appropriate suggestion in this inferred context. Also, to be fair, I think it's not mathematically impossible to use dark regex magic (with look-behinds and such) to parse HTML, but that's a discussion for another day...
- bazoom42 3y agoThe question is about tokenizing XHTML, not parsing it into a tree structure like a DOM, which is a critical distinction. Regular expressions are a perfectly valid way to tokenize. This is why the snarky answers does not suggest a better solution - there isnt one! If you scroll down long enough, you will see answers explaining that. But they arent upvoted as the answers suggesting the questioner is an idiot.
- pasc1878 3y agoNo accepting an answer can ONLY be done by the person asking the question.
- borland 3y agoThat answer is only there because it's really old, from the early days of S.O. where people were allowed to ask questions that weren't super serious binary yes/no style. It'd get moderated and deleted in a heartbeat today. A forlorn monument to the cool place that S.O. once was
- School-Cotton 3y agoMaybe I’m just a fun-hating asshole but personally I find this kind of thing annoying, not cool. People are just trying to get work done, not see someone’s attempt at cringey “nerd culture” humor.
- the_af 3y agoYou agree with SO: those answers are no longer allowed, and haven't been for years. They are only kept as historical artifacts, and marked as such.
- eitland 3y agoThat is not what most of us complain about I think. I and I think many other are sad that S.O. removes many serious work related questions (have lost count of how many times I saw the perfect question with the perfect answer, with a note that this isn't what Stack Overflow is made for and these questions only exist for historical reasons).
- Etheryte 3y agoThe answer can only ever be accepted by the asker, not even mods can change that. It's actually not that rare that the accepted answer is not the one with most votes in which case the accepted answer is somewhere further down, not the first one on top.
- cowthulhu 3y agoOops, you’re right! I was totally misremembering.
- deleted 3y ago[deleted]
- mihaaly 3y agoIronic, as answering an other question ("What alternatives are to do X?") instead the original one is not indicating smartness at all.
- Lutger 3y agoThe question explicitly invites the kind of witty reflection shown in the accepted answer, by adding: "and what do you think?" As mentioned elsewhere, this is an old question and both the kind of question and answer wouldn't be allowed these days. However, I also fundamentally disagree that questioning the assumptions in a question is unhelpful. You want to solve a problem, find an approach and want help because you have problems with the approach? What if the approach you took _is_ wrong? Its very helpful especially for advanced beginners or at the intermediate level, to be given a different way of solving the problem even if that is not what you asked. It depends on context if this is just pedantry or genuinely helpful. The best answers I found start with answering the question that was stated, but then proceed in showing how the problem behind the question can also or better be solved.
- School-Cotton 3y ago“You didn’t actually want to do X, here’s how to do Y instead” may indeed be helpful for the beginner who initially asked the question, but it’s very unhelpful for me who finds the page years later actually wanting to do X.
- waterproof 3y agoI disagree- on SO you’ll usually get some literal answers as well as the more high-level, question-the-premise ones. Why not both?
- School-Cotton 3y agoBecause in many cases people don't bother giving the real answer once a comment already has an answer, especially a highly upvoted one. I'm fine with indirect, "question-the-premise" comments, but they should be posted as comments, not answers, because they are in fact not answers.
- _gabe_ 3y ago> “You didn’t actually want to do X, here’s how to do Y instead” may indeed be helpful for the beginner who initially asked the question Stack Overflow isn't a site for beginners, it's for "professionals". At least, that's what all the Stack Overflow defenders tell me every time I criticize the snarkiness, rudeness and patronizing manner of many answers/comments you receive on Stack Overflow.
- Yajirobe 3y ago> If you parse HTML with regex you are giving in to Them and their blasphemous ways which doom us all to inhuman toil for the One whose Name cannot be expressed in the Basic Multilingual Plane, he comes. Jesus this is cringe
- zeroonetwothree 3y agoI thought it was amusing. Reminds me of a lot of 90s internet humor.
- RHSeeger 3y agoTo be fair, that question was written during a period when "how do I parse this html with regular expressions" was asked multiple times per day. And "regular expressions are not a reasonable tool to do that, use a parser" was the correct response to 99% of them. And, at some point, someone decided to throw out a more amusing version of that response. It _was_ funny at the time.
- waterproof 3y agoIn this case, the question actually says “and more importantly, what do you think?” So the answer is actually on topic. It may be a bit… stylistically unusual, but I think I came away with a pretty good idea of what the answerer thinks.
- usrbinbash 3y ago> and dozens of people post answers claiming that this is the wrong way to do it and that they should use some other tech to solve the problem Yes, and they are factually correct in doing so. The correct answer to the question: "How do I use a hammer to tighten a screw" isn't a lengthy description of how to perform some magic with a hammer. The correct answer is: "You don't. Use a screwdriver." HTML isn't parseable with regex. The various answers under the question explain in great detail why [1] that is the case. SO isn't a help forum, it's a question archive. The purpose of an answer isn't to solve one guys specific question, but to provide an answer that is useful to all people who ever stumble upon this question. [1]: https://stackoverflow.com/a/1758162/19508364 https://stackoverflow.com/a/1758162/19508364
- firesteelrain 3y agoYour response and the other responses are proving our point. It wasn't about context free grammars, level 2 or level 3, etc. It was a very limited subset of a problem. Answer should have been, "while I don't recommend doing it the way you want to do it, that should work for your limited subset".
- usrbinbash 3y ago> Answer should have been Yes, and answers on that very page, with lots of upvotes, do exactly that. People looking for answers online, can reasonably be expected to scroll down a page with results.
- anter 3y ago> The correct answer to the question: "How do I use a hammer to tighten a screw" isn't a lengthy description of how to perform some magic with a hammer. The correct answer is: "You don't. Use a screwdriver." My car broke down in the middle of the desert because of a screw that came loose and all I have is a hammer. You have just condemned me to death because you assume you know better.
- BeetleB 3y ago> HTML isn't parseable with regex. Poster is not asking for this. He is asking how to parse a specific subset of HTML. And it is demonstrably parseable. > The correct answer to the question: "How do I use a hammer to tighten a screw" isn't a lengthy description of how to perform some magic with a hammer. The correct answer is: "You don't. Use a screwdriver." It is not the appropriate way to tighten a screw, but there likely is a correct way to do it with a hammer. It is fine to point out that there are better ways to parse that HTML, but it is not wrong to do it with regexes. Sorry to be blunt, but having coworkers like you make the job really annoying. I'm not a newbie, but a seasoned programmer. If I'm asking a question and am in a domain with a fair amount of experience, don't give me patronizing answers.
- tlogan 3y agoThe funny thing is that the person who worted top voted answer is not smart all. He might look smart for a newbie but the question is about tokenizaion and not about parsing. So here is the reason: the top voted answers are wrong.
- diemechanist 3y ago> "Some people on Stack Overflow care more about showing off how smart they are rather than answering questions, and I think the point system attracts these people" "Some" is an understatement.