Unless the down voter leaves a comment, there is no way to figure out who they were or their intention with their vote. Voting is private.
Absolutely everyone who spends time asking or answering questions here will get their fair share of up and downvotes. The reason questions regarding why someone may have downvoted an answer relatively seldom appear here is because there is no definite answer to that question. A more interesting question is "How can I improve this answer?"
Answers should generally answer the question as it has been posed. In this case, the question is "Does parens for pattern matching need to be escaped inside sed regex-es?".
One way to improve your answer may be to address the user's issue with the parentheses (that is to say, explain how parentheses are used in regular expressions in sed
). You may then recognise that the user is using the wrong sed
command (d
rather than s
), explain why, and then suggest what they should do instead.
This makes your text read more like an answer to the question instead of a comment on another answer or an expansion of somebody else's comment. We like specific answers to specific questions, not a discussion that moves from answers into comments into new answers based on ideas or follow-up questions in comments, etc. (these things are ok, but the resulting answer should still be an answer to the original question, at a minimum).
I would also avoid "This worked for me when solving a different issue and here's my code for that"-type of answers. If you are enthusiastic about a specific solution that you have come up with for your own problem, it is better to post a separate question that you immediately self-answer (this is allowed and encouraged as long as the question is not a duplicate of existing questions).
I'm also noticing now that your suggested sed
command is identical to the sed
command in the accepted answer.
What could you have done differently? Well, given that the point of your answer was to remove the anchoring of the regular expression and the g
flag at the end, you could have suggested this as an edit to the accepted answer. As it happens, this was instead an edit that I made (along with adding extra text), prompted by reading the accepted answer, prompted by the question bubbling up on our front page due to your answer.
An additional edit that could possibly be made to the accepted answer is to address the user's issue with parentheses or at least say why parentheses aren't needed or wanted in the suggested command. This is probably not enough to warrant its own answer though, as the second part of that answer would invariably have to duplicate the sed
command from the accepted answer again unless a novel and better approach is provided.