I have noticed an abundance of regex answers that consist of nothing but a pattern.
Obviously, not explaining the patterns will lead the (often clueless) OPs to just copy and paste the solutions. Consequently, they will come back each time they have another regular expression problem to solve. We are throwing fish at them instead of teaching them how to fish. This is the opposite of what Stack Overflow is supposed to be: a repository of quality answers.
There has been at least two complaints about the quality of regular expression answers in the past:
The proposed solutions did not yield any improvement IMO. Apart from being almost always Too Localized anyway, a lot of regular expression questions are still answered with one-liners and no explanation of the patterns whatsoever.
Examples for bad regular expression answers:
- https://stackoverflow.com/questions/13513540/create-regex-expression
- Regex to match a number pattern
- Remove the first character of each line and append using Vim
Examples for better regular expression answers:
- Regular expression replace in C#
- Remove the first character of each line and append using Vim
- HTML-parsing regular expression (shameless self plug)
As a moderator I can already leave post notices for Insufficient explanations, stating:
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer: please explain why you're recommending it as a solution. Answers that don't explain anything will be deleted. See Good Subjective, Bad Subjective for more information.
However, given the size of the problem, I don't think it's expedient to put these notices below pattern-only answers. My suggestion would be treating answers to regular expression questions that only contain a pattern as Not An Answer from now on.
It is my opinion that people should downvote/flag/delete them, just like they do with link only answers. Moderators should delete them on sight. The community should clearly signal that we do not want those. The hope, of course, is that people will eventually learn that they should provide more comprehensive answers.
But I am open for suggestions on how to treat those.