Regex: DateTime

  • hello. I have a little problem on a date-time

    november 25, 2012

    For this I write a simple regex: \D+[a-z] \d{2}, \d{1,4}

    The problem is when I have text before date, for exemple:

    text text november 25, 2012 text

    Well, in this case my regex selects also the text, not only the date. So I need to modify a little bit my regex to find strictly my date, and not the text before or after.

    Can anyone help me?

  • I find the solution

    [a-zA-Z]+ \d{2}, \d{1,4}

  • @Vasile-Caraus

    I notice that you seem to have MANY problems with creating the regular expressions you need. Even the simple ones (above) seem to give you difficulty. If I may make a suggestion, invest in a copy of RegexBuddy and/or RegexMagic, and your life (at least as far as regex goes) will be greatly simplified.

    Perhaps it is worth pointing out that, unless the regular expression questions you have are directly related to the intricacies of Notepad++'s regular expression engine, regular expression questions really don’t belong on this Community Forum. So, for example, there is nothing Notepad++ specific about [a-zA-Z]+ \d{2}, \d{1,4}, so it really should not be discussed here. You will get better/faster answers to questions about such basic regexes on other sites.

    There IS a lot of tolerance for basic regex questions here, that I really don’t understand. This is comparable to people that ask questions about HTML rendering and think it is a valid question for this forum because they use Notepad++ to write their HTML !

  • @Vasile-Caraus ,

    Here’s an example of what I consider a valid regex-related question to ask in this Community forum:

  • I’m sorry to hear that. I am a beginner, not a programmer, but I learned to use Regex very well as data processing tool. It was a good ideea to do a section just for beginners.

  • @Vasile-Caraus

    I second @Alan-Kilborn 's remarks, IMO you should no longer be considered a beginner. After the amount of questions you posted related to regular expressions and the answers you got based on goodwill of other community member(s) (i.e. @guy038), you’ve had plenty of time to learn the basics.

    There are lots of sites available for regular expression related questions specifically, to name some:

    1. Learn regular expressions the hard way
    2. Regular Expressions 101
    3. (by RegexBuddy author/developer).

    Furthermore, one doesn’t have to be a programmer to learn and use regular expressions.

Log in to reply