10

What are the qualities of a good, answerable question that involves regular expressions?

What information does an asker need to include to be able to receive good answers to questions?


I often see questions where users, who are new to regular expressions and often new to StackOverflow as well, don't provide enough information to properly answer the question.

Oftentimes they don't include the language that the regex is to be used in, or there aren't enough examples to properly construct any pattern.

I find myself regurgitating the same basic comments on these sorts of questions, which could be perfectly reasonable if the asker would just put a little more effort into crafting them.

I'd like to be able to point users to a vetted page that cover what information must be provided in the question to receive a good answer, and why the information is necessary. Ideally it would also include simple examples demonstrating why the extra effort makes a difference.

1
  • 5
    One point is often: Don't assume a regex is the best method to achieve the results. Commented Feb 22, 2014 at 7:54

1 Answer 1

7

I believe that a question should state:

  • the language

  • the purpose of the regex (this should help verify the need for regex and whether a different approach may be more suitable)

  • examples of both matching and not maching inputs

  • any code where the regex is to be used (that also helps to verify what's the real requirement and whether regex is the best solution)

  • (if available) any attempts at creating a regex

It may be a good idea to create a page with "how to ask" information. One place to create it is the wiki page if the regex tag.

Update:

I should have checked before answering: the regex tag page already contains a section on asking regex questions. Most of what I mentioned above is already included.

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