-5

There is this question that was closed for not being clear: Use grep to find files containing regex patterns

I have found it while searching for a similar issue.

It is not given what is needed to make it clearer. There is no comment towards that. Disappointed it has no real answer (only answer given does not give a resolution), plus closed, I made an edit hoping it would make more sense.

edit is accepted by reviewers, but reverted in just few hours.

@muru now uses this sentence in comments: "the question is definitely not clear enough by any means"

But the question is clear as day for me, yet he is telling me this is "shoehorning my interpretation".

https://chat.stackexchange.com/rooms/149230/discussion-on-question-by-clayton-dukes-use-grep-to-find-files-containing-regex

It is clear I am talking to a wall now, and you can tell everything I may say now feel offended to him just because he rose to a position earlier than me.

What now? Should I just shut up and behave and wait until grumpies leave?

1
  • I don't see any issue with posting essentially the same question, but with a limited scope. For example, about detecting quoted strings containing a backslash followed by a certain set of characters, or finding strings occurring between paired slashes, or any other specific description of how regular expressions usually occur in a specific type of document.
    – Kusalananda Mod
    Oct 21, 2023 at 14:04

2 Answers 2

5

Despite what you and Kusalananda say, the question is clear as mud to me. Here are a few questions to determine what you think you understand from that question:

  • Is abc a regex? Why or why not?
  • Is (the empty string) a regex? Why or why not?
  • Are * or ** regular expressions? Why or why not?

If the answer to these questions is yes, why is .* not the regex that matches strings that are regexes? (While we're at it: let's make a stronger claim: it's the only regex to match all regexes.) If the answer to these questions is no, then what do you mean by "regex" (or "regular expression", or "pattern" or whatever you chose to call it)? And whatever be the answer to that, how do you know that's what the OP of that question meant?

13
  • It is clear that they are asking for an expression to match regular expressions. It's too broad as they don't specify in what context the expressions the want to match occurs in. It's too broad rather than unclear. Well, I could possibly agree that this is unclarity too, depending on interpretation, but it has to do with the scope of the question rather than understanding the question. The edit that you reverted did not address the scope, so that revert was all good IMHO.
    – Kusalananda Mod
    Oct 21, 2023 at 14:20
  • @Kusalananda on that, where you and I disagree is that to me, OP wants an expression to match something. They have some idea of what that something is, and they think that their idea of that something matches exactly what they call regular expressions. But they and the meta-OP here haven't defined that exactly. It might be that their definition is 'any string that doesn't cause PHP's regex engine to complain'. It might be that it is instead 'any string that describes a possible DFA or NFA using the notation in a given book'. Without that definition, it is not clear what they want to match.
    – muru
    Oct 21, 2023 at 14:27
  • 1
    Well "I want to find files with ANY regex patterns" is clear, but too broad (to generate any useful answer other than your .* pattern, or indeed test -f filename). But, having said that, I'm agreeing with you that it's unclear what it is they actually want, since they are electing to not show any real input that they want to perform the search in. I'm just echoing what your comment says: They probably have a real issue, but they are unable to present it in a way that would generate useful replies.
    – Kusalananda Mod
    Oct 21, 2023 at 14:36
  • 1
    (cont.) Whether it's unclear or too broad is not really important; the question should be closed until it is improved upon by the original user.
    – Kusalananda Mod
    Oct 21, 2023 at 14:37
  • @muru, what you have just presented so far, are all part of the answer itself. Therefore, they should be presented in an answer, instead of saying "question is not clear". being broad is not the same thing as being unclear. and going back to your first comment on that post, you could ask the OP about this broadness but you chose to make a cryptic know-it-all comment. Oct 24, 2023 at 12:25
  • @YılmazDurmaz you can choose to interpret it that way. I disagree. I'd rather have a question with a useful answer than "here's this otherwise useless thing which technically fits your question."
    – muru
    Oct 24, 2023 at 12:34
  • @Kusalananda, thanks, "question is already clear but broad". I agree if we can hear from the OP of that question. but a question being "too broad" can always be solved with an exemplary comment or multi-purpose answers. no comment on the post to that, and no answer towards that was given because it is closed. Oct 24, 2023 at 12:35
  • 1
    @YılmazDurmaz In this case, it's only the original user that could salvage the question. Posting multi-purpose answers would not work well for the same reasons we don't think answers to open-ended questions or questions soliciting opinions are very useful. They tend to turn into dump grounds for answers whose only common denominator is that they circle vaguely around the same keywords.
    – Kusalananda Mod
    Oct 24, 2023 at 12:46
  • 1
    @YılmazDurmaz As I said in an earlier comment, if you have a similar question but with a more specific context, including examples of real input and expected outputs, which isn't answered with .* (which matches anything and the empty string, because everything and the empty string are all valid regular expression), then, by all means, post that question.
    – Kusalananda Mod
    Oct 24, 2023 at 12:48
  • @Kusalananda do you have the right to remove comments? then, can you please remove muru 's and my comments in it and add either add your comment about how to make the question clearer, or give a link here so he may see what to do. wouldn't this be more acceptable solution at the moment? Oct 24, 2023 at 13:02
  • 4
    @Kusalananda, "It is clear that they are asking for an expression to match regular expressions" - that wasn't clear to me at all. It's one possible interpretation of the question, which I understood to mean that the OP wanted to identify the set of files containing anything that could be construed as an RE. Since literal text can be an RE that set would be the set of all files and therefore the question doesn't make sense as asked. Ultimately, the question is (correctly, IMO) closed as unclear, but even here it seems there are several ways of looking at the question meaning Oct 26, 2023 at 13:02
  • 1
    @ChrisDavies Sorry, yes, I should have formulated that as "wants to find files that contains regular expressions", which to me is the same thing as what I said (I expressed this as test -f filename earlier, which is an expression of sorts). I believe that we're basically all repeating each other over and over again.
    – Kusalananda Mod
    Oct 26, 2023 at 14:22
  • 1
    @ChrisDavies "Since literal text can be an RE that set would be the set of all files..." Well, strictly speaking this is not true. There are many possibly strings that would not be valid as regexes, for example unclosed parentheses or square brackets. But that would be a completely different question, "How can I validate that some text forms a valid regex?" It seems to me the original question is based on the misconception that regexes themselves have some identifiable pattern such that they could be searched for directly, like searching for "files containing a phone number."
    – Wildcard
    Mar 12 at 22:55
2

Looking at this I'd like to make some observations:

  • It's generally a good idea to avoid inferring any emotion in any response on forums and StackExchange especially. There's a really great discussion of this in How To Ask Questions The Smart Way: Dealing with Rudeness. The short version is that it's incredibly easy to misinterpret terse, direct responses as rude or "grumpy" when they're simply not.
  • Some questions, such as the one you asked, have the correct answer: "That's impossible". Invariably the OP is unlikely to be happy at receiving this response. So some are slow to come right out and say it as it can spark more tiresome battles than you might expect.
  • It's common enough, that a little more probing will narrow such a question into something that's solvable. Particularly in the case of XY questions. So some people chose to probe a little more about the what and why before offering up an opinion. In doing so, it can can really come across as if the OP is being unclear or leaving out important detail. Especially when they are disinclined to discuss the question of "why they need this".

I personally preach responding to such questions in three parts, where the first part would invariably answer directly... "that's impossible". But sadly it's not a commonly followed pattern.

In summary:

I don't think anyone was being grumpy or rude, but they could have communicated more quickly and clearly that it was [mathematically] impossible to solve in it's current form, and given it's nature, unlikely to be useful to any future readers.

Does that mean it should have been closed? Err. Not sure.

2
  • Thanks. In this case, my opinion is that the question can be answered as being "impossible at full-scale but possible in subsets". Yet, the closing without such answer, even as a single sentence in comments, is what I see as injustice. Then came the now-deleted dialog that I called as the grumpiness, and then this post to hear more voices. Dec 13, 2023 at 0:51
  • 1
    @YılmazDurmaz yeah a response indicating that it's impossible would be been very worthwhile. But a comment would have sufficed. On the matter of answer or not and close or not... there is a point that took me a long time to appreciate: closing is deliberately taking a question out of the mainline queue reducing readership to improve signal to noise ratio of the remaining questions. As a general rule, it's not good to leave unanswerable questions open racking up views. Personally I may have voted to close but with a descriptive comment, I feel "unclear" is an overused reason. Dec 13, 2023 at 2:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .