newbie: I'm trying to parse out the td tags in this HTML and I can't get the regexp right
expert: Please don't parse HTML with regexps - try HTML::TableExtract.
newbie: my regexp is /<td>(.*)</ but it doesn't work
mst: newbie: You can't use regexps to parse HTML. Look at this module: ... Now we've answered you twice. If you ask again, you'll be muted for a few minutes.
Continued persistence on the part of the newbie should be met the same way you would in real life. Tell him if he keeps bothering you, you'll uninvite him from your club, and then follow through. The community's purpose is not to educate outsiders who don't wish to receive an education, but for the enrichment of people who will participate as equals. Establishing a norm of unpleasantness, even on the periphery, for the sake of a dubious chance at helping out is not a tradeoff I'd make.
newbie: WTF. But I just wanted help with my regexp! Quit being a nazi! You have no right to ban me I'm just trying to ask a question!
or them quitting immediately. Or at least, it has usually been one of the two in my experience. But I'm not going to claim that means the technique doesn't work; just that it hasn't, for me, so far. I should probably experiment more with it but I suspect it will, oddly, come across far more heavy handed than a bout of profanity.
Well, no, a lot of the time it does work, and I never say a word or I'm the one doing the explaining.
The point of the example is that there's a fairly common pattern where people don't listen, don't become enlightened, and don't stop asking the same question because they've managed to get tunnel vision through staring at their non-working code for too long.
At which point a short sharp verbal slap upside the head often serves to dislodge the cobwebs, at which point they start thinking again, read the explanation properly and become enlightened.
A better way would look something like this:
Grasshopper: I'm trying to parse out the td tags in this HTML and I can't get the regexp right
Master: HTML allows many variations. Making a regex to handle all possibilities is too hard.
Master: Instead use HTML::TableExtract. You can learn to use it faster than you fix all the tricky problems in a regex.
However, your point that the example sucks is good; I've fleshed it out somewhat (and still consider it representative of what I'm attempting to describe)
Still, why do so many seekers-of-wisdom do that? Is it fear of the documentation, which can be pretty intimidating for a novice? Are they truly, seriously lazy gold brickers? Are they just thick? If it is the first, what they need is reassurance and a very simple, unintimidating example.
I wonder if there is a market for teaching chatbots? They'd have a hard time being worse than the endless "tutorials" on the web.
In a lot of cases, as I note elsethread, I think it's often that they've been locked into tunnel vision over the "solution" they're currently attempting - they have a serious case of XY problem but their self-made blinkers prevent them seeing that.
A much shorter version of this drama gets played out on technical channels when one of us goes "hmm, why isn't this working?", somebody else goes "wtf are you doing that for?" and the first one goes ".... oh, FFS, because I'm an idiot". But it takes practice to be that in tune with your inner idiot.