Ultimately, I see this as coming down to (from the tour, even)
Don't ask about...
Questions you haven't tried to find an answer for (show your work!)
Has the person asking the regex question at least made an honest effort to solve their problem? Do they at least show a basic grasp of fundamental/rudimentary regex concepts? Or are they asking without any evidence that they really tried (aka "do this work I can't be bothered with for me for free")?
Regex is much like Othello. It's easy as pie to write a basic regex. But once you turn to more complicated regex patterns/issues and to performant related problems, everything suddenly goes from 10 minutes of looking up a regex manual to headaches of trial, error, research, and unexpected gotchas or tricks that aren't apparent at face value to someone who only rarely (at best) writes regex patterns.
In effect, there are methods of matching certain desired patterns in Regex that could be equated to expecting someone to come up with the Muenchian grouping method in XSLT… all on their own. Because grouping in XSLT is such a dirt common need, and relatively easy to word as a search, it's not hard to find the information needed to implement it in XSLT 1.0 (but people still get stumped on particulars of the method in application to exact circumstances, resulting in appropriately narrow questions). It's frequently much harder to word a search based on a pattern need in such a way that it captures the concepts that need to be applied to make it work.
I don't see a problem with these questions, when they do show appropriate attempts at solving them before asking. Honestly, in the case of the linked question, I don't think it should be closed:
- There is regex code there that the asker came up with to try to use. The asker clearly tried to arrive at their own solution: whether by looking up a regex or trying to create their own.
- There is an attempt to take the code in the direction of solving the asker's desired outcome, with related comments about why the asker isn't using that particular code.
In the end, if someone can't figure something out on their own but is actually trying to do so, the best answer may just be to walk away if it bothers you. It's not hurting anyone, and if there is a particular area to it that was being difficult for someone it may be helpful to others in regards to seeing how to work out that particular detail. If that's not the case, no one should be voting up the question or any answers it does happen to receive, which effectively lets it all but disappear.
While the wording of regex questions may often make this more difficult in practice than for some other questions, I think it still applies. I've personally had more than one XPATH issue get resolved by looking at what would have been a closed question if the regex question linked here were deemed to be something inappropriate and the same rubrics in turn carried over to XPATH questions. Not because the problem was exactly the same or the answer fit my problem per se, but because the logic behind it was what I needed for a situation that in part had some similar elements.
At the same time, if someone simply posts a problem with no evidence of having put effort into solving it themselves, it should certainly be closed. I would agree that if the following were true, the question should be closed:
What close reason? The only answer so far suggests Off-Topic -> Why
isn't this code working, but I disagree with that, since the askers
don't provide code at all - they are requesting code to be provided to
them!
But that's not actually the case here.
For the times that is true, yes, the question should be closed as per slugster's answer referencing the Off-Topic close for debugging related questions lacking all necessary details: failing to provide an attempted regex pattern (one already showing evidence of having been worked on to try to reach the solution, not just a random copy and paste that makes no sense in the context of the problem) that isn't working fits well into this, to me.
regex
answer - and have all the other posts marked as a duplicate? There are sometimes a few original regex questions that ask for something uncommon or difficult- but generally that is not the case.