Earlier quoted context omitted.
Go ahead - show me wrong.
I have already done that, what I am unsure of is how to go about convincing you. With compilers - I just fix the bug myself. With humans, I have to convince the human to self-correct. Common problem in distributed systems that - leader election.
Is there a regular expression to detect a valid regular expression?
141–150 of 224 posts
Re: Is there a regular expression to detect a valid regular expression?
#142Earlier quoted context omitted.
Just considering the language of balanced parentheses, the only memory needed is a single integer to track depth. If we see a "(", increment. If we see a ")", decrement. If we never go negative and end up with zero, that's a balanced parentheses expression. (To be clear, the parser I've described is not a regex parser.) Adding the rest of the regex machinery makes this a bit more complex, but in general, if the compu…
)))((()(()
Re: Is there a regular expression to detect a valid regular expression?
#143Re: Is there a regular expression to detect a valid regular expression?
#144We 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 ha…
> 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 expression?
#145We 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 ha…
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 expression?
#146Earlier quoted context omitted.
it's sad that today the stack overflow majority shares your mindset and an answer like that would drown in downvotes or killed by moderation. some people like to act super serious all the time like they're playing a sitcom version of what they think adulthood is in a quest to be the most boring person on earth like if that's the goal of human interaction
You can be funny and helpful at the same time.
Re: Is there a regular expression to detect a valid regular expression?
#147I believe Zalgo has the answer to this, via an equivalent question. https://stackoverflow.com/questions/1732348/regex-match-open...
From that answer: "You can't parse [X]HTML with regex". I've always wondered how that came about. How come very early in the development of the web no one important enough for people to pay attention to them said, "Hey...wait a second. If this thing becomes popular, people are going to really want to processes web documents with their usual text file processing tools and techniques. We really outta make this thing re…
Re: Is there a regular expression to detect a valid regular expression?
#148We 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 ha…
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,…
Re: Is there a regular expression to detect a valid regular expression?
#149We 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 ha…
> 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.
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 expression?
#150We 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 ha…