News for hackers. Stuff that matters.
Re:Is there a regular expression to detect a valid regular e... by fortran77 on Sunday September 08, 2019 @01:32PM (#20911949)
We see good examples of "the problem with StackOverflow" here.

The second highest-rated answer is "Evaluate it in a try..catch or whatever your language provides." and it's justified because "Surely the real question is 'how do I validate a regular expression'."

This is a fascinating computer science question and I'm pretty sure the questioner wasn't asking "how do I validate a regular expression" because he would have asked that.

Re:Is there a regular expression to detect a valid regular e... by mholt on Sunday September 08, 2019 @02:32PM (#20912398)
I also think it's a fascinating question, but if the asker wanted a theoretical answer more than a practical one, it should have been asked on the CS or CS theory stack exchange: https://cs.stackexchange.com/ & https://cstheory.stackexchange.com/
Re:Is there a regular expression to detect a valid regular e... by piedar on Sunday September 08, 2019 @02:51PM (#20912540)
...neither of which existed when the question was asked.
Re:Is there a regular expression to detect a valid regular e... by sosborn on Sunday September 08, 2019 @01:51PM (#20912080)
Personally, I think this is a strength of StackOverflow. I think most people read through all of the answers, and this particular one keeps people who know nothing about regex from trying to evaluate regex with regex.

And for those with a deeper understanding, they have an answer that provides the intellectual stimulation they are looking for.

Re:Is there a regular expression to detect a valid regular e... by jogjayr on Sunday September 08, 2019 @04:21PM (#20913159)
> I think most people read through all of the answers

You're vastly overestimating what most SO users come to the site for. They (and I include myself) just want something that'll work and isn't horrible. Even "not horrible" is something I care about but I know that many devs don't.

Re:Is there a regular expression to detect a valid regular e... by perl4ever on Sunday September 08, 2019 @08:13PM (#20914208)
If somebody doesn't know the answer to their question in advance, which by definition they don't, it's by no means guaranteed they will know a horrible answer when they see it.
Re:Is there a regular expression to detect a valid regular e... by avar on Sunday September 08, 2019 @02:23PM (#20912333)
It really doesn't matter what the questioner wanted. The main utility of sites like Stack Overflow is not to give this one person the answer to their specific problem, but to be a useful landing page to people searching for things related to the question later.

A lot of those people are novices when it comes to regexes, and it's useful to make it clear that there's some things that are better solved with other tools, even if you can abuse extended regexes syntaxes to solve them.

Re:Is there a regular expression to detect a valid regular e... by mannykannot on Sunday September 08, 2019 @02:31PM (#20912387)
The answer in this case does not even satisfy that standard.
Re:Is there a regular expression to detect a valid regular e... by Izkata on Monday September 09, 2019 @08:38AM (#20917539)
I think it's a more frustrating example:

> If so please give example code below.

The phrasing, especially combined with what time of year it was asked, makes me think it's a homework question from a CS logic course where they have to provide an example showing the answer is "no", and explain why.

Re:Is there a regular expression to detect a valid regular e... by thereare5lights on Sunday September 08, 2019 @01:52PM (#20912084)
> I'm pretty sure the questioner wasn't asking "how do I validate a regular expression" because he would have asked that.

In my experience, people sometimes ask for how to solve the more immediate detail they’re working on rather than the broader problem.

Re:Is there a regular expression to detect a valid regular e... by corobo on Sunday September 08, 2019 @02:32PM (#20912392)
This came up recently. Going to start calling it the XYZ problem

https://news.ycombinator.com/item?id=20861806

Edit: page refreshed and sure enough the sibling comment calls it out by name

Edit2: Called it the XYZ problem: https://cohan.io/the-xyz-problem/

Re:Is there a regular expression to detect a valid regular e... by NieDzejkob on Sunday September 08, 2019 @02:22PM (#20912322)
See also: the XY problem [0][1].

[0]: http://xyproblem.info/

[1]: https://en.wikipedia.org/wiki/XY_problem

Re:Is there a regular expression to detect a valid regular e... by ridaj on Sunday September 08, 2019 @02:37PM (#20912435)
Maybe the second-ranked answer is trying to second-guess the question, but at least the highest-ranked answer is precise...