• Login
Community
  • Login

Regex: DateTime

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 4.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V
    Vasile Caraus
    last edited by Feb 8, 2017, 11:35 AM

    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 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?

    1 Reply Last reply Reply Quote 0
    • V
      Vasile Caraus
      last edited by Feb 8, 2017, 1:09 PM

      I find the solution

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

      A 1 Reply Last reply Feb 8, 2017, 1:28 PM Reply Quote 0
      • A
        Alan Kilborn @Vasile Caraus
        last edited by Feb 8, 2017, 1:28 PM

        @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 !

        1 Reply Last reply Reply Quote 1
        • A
          Alan Kilborn
          last edited by Feb 8, 2017, 2:35 PM

          @Vasile-Caraus ,

          Here’s an example of what I consider a valid regex-related question to ask in this Community forum: https://notepad-plus-plus.org/community/topic/13249/pythonscript-search-different-than-n-search-when-using-and-leading-uppercase

          1 Reply Last reply Reply Quote 1
          • V
            Vasile Caraus
            last edited by Feb 8, 2017, 2:56 PM

            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.

            1 Reply Last reply Reply Quote 0
            • M
              MAPJe71
              last edited by MAPJe71 Feb 8, 2017, 5:01 PM Feb 8, 2017, 5:01 PM

              @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. Regular-Expressions.info (by RegexBuddy author/developer).

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

              1 Reply Last reply Reply Quote 1
              5 out of 6
              • First post
                5/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors