7

So this question (which actually isn't even a question)...

It seems the only purpose is to get someone to solve or validate a particular regular expression.

Feels much to me like doing somebody else's homework (no matter if that's the case or nor).

The user will never learn anything, if they post their very specific inquiries here without studying and learning anything from it (which to me seems to be the case).

So what's the recommended action in this case? Just let it be, until some kind soul actually decides to solve their specific problem?

I actually believe a good answer could be written to explain some of the aspects of regular expressions.

On the other hand, I wonder what could be written here about regular expressions that isn't already in the official documentation about the subject.

So frankly, I'm a bit at a loss here - both for the specific post, and also this particular user's post history taken into account.

4
  • I'm not sure how that's on-topic... it doesn't seem to be about Ubuntu. Also, Can't be reproduced seems relevant - specifically "it's unlikely to help future readers". But you can always downvote, and flag as off-topic
    – cocomac
    May 4, 2022 at 15:29
  • I did exactly both of those things, after some consideration. But still curious to hear other opinons. And I also agree very much with Thomas' comment on the question. May 4, 2022 at 15:31
  • @cocomac that is a shell script, most likely bash. Why would it be off topic?
    – terdon
    May 4, 2022 at 15:41
  • @terdon My bad, I missed that it was in a shell script, so you're correct. It would be on-topic, sorry
    – cocomac
    May 4, 2022 at 16:39

1 Answer 1

6

That seems like a perfectly on topic question to me. We handle shell scripting and this is about shell scripting. It's about using a specific flavor of regular expression, Extended POSIX Regular Expresions (ERE), inside bash's [[ builtin.

Now, if the user has a history of not learning, then we are all free to ignore the question, or downvote it if we feel it is a bad question, and go about our day. But apart from that, it seems like a perfectly on topic question well within the core subject matter of the site. It's a bad question since we have no context, no question and no explanation of what happens when the OP tries the existing code, but it isn't off topic.

Relevant Meta discussion: Are bash/shell scripting questions on topic?

4
  • Valid points. And I agree that it is "technically" not off-topic. But I still feel it also tilts towards "unlikely to help future readers". Hence, why I created this post in the first place. 👍 Also, I wasn't fully aware of the subtle differences between RegEx flavors. For my own part, I've tested in RegExr, and it has also worked in Bash. May 4, 2022 at 16:34
  • 2
    @ArturMeinild yes indeed, this post is very useful!
    – terdon
    May 4, 2022 at 16:35
  • @ArturMeinild this one will work in bash too (if the OP removes the extra space between the \[ and ([0-9]+\;)), but consider something like \w+\s\w+. That matches foo bar in PCREs, but fails in EREs since EREs don't support \w or \s.
    – terdon
    May 4, 2022 at 16:44
  • Yes, it was my impression that the "basic" syntax is the same, but some of the more "exotic" expressions will vary. May 4, 2022 at 16:45

You must log in to answer this question.

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