How to Ask A Regular Expression Question RRS feed

  • General discussion

    1. Don't confuse the end goal with what needs to be done. A lot of people like to tell about where the data will go, or how its manipulated. Frankly we don't care.
    2. Provide a clear example of the data in multiple forms and incarnation. Many times people will get an answer and say, "Oh there was one other data example which your pattern doesn't work against." Always try to provide all facets of data.
    3. What regex pattern have you tried? Don't be afraid, we all start somewhere and your pattern could let us know to tell you about feature X of regular expressions which you may not be aware of. 
    4. Put in a descriptive title. "Regex help" is incredibly bad....be original and figure out a good title.
    5. Before posting re-read it and remove any superfluous language or incidentals.
    Here is an example of a perfect Regex question with a good data example which shows possible problems:

    Title: Unable to Get a word at the beginning of a sentence

    I want to get each word at the start of each new line. Here is my example, with Bolded items which need to be captured

    The rain in
    spain falls
    mainly on the
    B5 plain.

    I have tried this pattern


    but it doesn't work. Please advise.

    William Wegerson (www.OmegaCoder.Com )
    Thursday, January 7, 2010 7:18 PM