Date: 2012-11-20 03:09 pm (UTC)
jack: (Default)
From: [personal profile] jack
You're right, breaking it down into two issues clarifies it, thank you.

One

OK, you're right, though this seems to be a fact about how programmers use language differently to people in casual conversation, not anything to do with regexes specifically. "Can I use X to do Y" could mean is there any conceivable circumstance where I could use X to do Y (eg. can I do an emergency tracheotomy with a pen lid). But if I go on stack overflow and ask "can I divide by two to find a square root", the helpful answer is not "yes, it works for 4" but "no, you need to use an iterative approximation".

This particular questioner didn't use the phrase "can I do Y with X", but I think most people reading would understand the answer in the sense of "is X a sensible method of doing Y".

For that matter, I think I think a better interpretation of what the answer is trying to say might be that you can't parse HTML (in the sense of "interpreting the HTML structure of the entire document" a typical HTML document using a regex. Even though you can do useful processing and parsing that fall short of parsing it in its entirety (see below).

Two

Of course, it's complicated by the fact that the questioner wasn't asking that, and what they literally asked could be done perfectly fine with a regex.

But I think this is one of the awkward cultural protocols which hasn't quite found an answer on stack overflow, if someone asks "how can I do [horrible idea]? I can't do [obvious non-horrible idea] but I don't want to talk about why not". Was this guy actually going to use his html-tag parsing code to do something you could sensibly do without trying to parse a full CFG, eg. scraping a website in a predictable format and stripping out HTML tags? Or was he, as many answerers seemed to suspect, doing this as a first step to trying to parse it in a more general way, when "I know it's not what you asked, but what you're trying to do won't work and you should do it this other way" is actually the most correct and helpful answer.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

Loading anti-spam test...

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org