Loading ...
Sorry, an error occurred while loading the content.
 

RE: [Clip] Regular Expression Question

Expand Messages
  • Peter Stagg
    Very succinct regex from Hugo This should also work: ^( d+( .| /)?)+
    Message 1 of 19 , Jun 5 4:03 PM
      Very succinct regex from Hugo

      This should also work:

      ^(\d+(\.|\/)?)+


      > -----Original Message-----
      > From: h.paulissen@...
      > [mailto:h.paulissen@...]
      > Sent: Wednesday, 5 June 2002 6:55 PM
      > To: ntb-clips@yahoogroups.com
      > Subject: RE: [Clip] Regular Expression Question
      >
      >
      > Larry, Peter, Ben,
      >
      >
      > >
      > > > (^\d?\d\.\d?\d\.\d?\d)|(^\d?\d\/\d?\d/\d?\d)
      > >
      >
      > Apparently there is a difference in the handling of the
      > following (at least to me this has nothing to do with the #12
      > beta release since this occurs in my regular bversion of
      > NoteTab as well):
      >
      > \d\d? - finds 0
      > \d?\d - does not find 0
      >
      > I do not know why there is a difference...
      >
      > For what it's worth:
      >
      > I would find the date (with or without leading zero) with the
      > following
      > expression:
      >
      > ^\d+((\.|\/)\d+)+
      >
      >
      > Regards,
      >
      > Hugo
      >
      > ------------------------ Yahoo! Groups Sponsor
      > ---------------------~--> Tied to your PC? Cut Loose and Stay
      > connected with Yahoo! Mobile
      > http://us.click.yahoo.com/QBCcSD/o1CEAA/sXBHAA> /dkFolB/TM
      >
      >
      > --------------------------------------------------------------
      > -------~->
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
      >
      >
    • Larry Hamilton
      Sherri, ... I was not clear on this either. I find that part of working with the regexp engine in NoteTab is more trial and error than I would like. I am not
      Message 2 of 19 , Jun 5 6:26 PM
        Sherri,

        > I didn't know a "^" could be used inside parentheses. Seems to work
        > tho.

        I was not clear on this either. I find that part of working with the regexp
        engine in NoteTab is more trial and error than I would like. I am not sure
        if it is me, or if I need better explanation in help, or more examples.

        It is sort of like calculus way back in college, I understood the examples
        in class and in the book, but there was never an example like the complexity
        of the homework problems. This whole thread has really helped, especially
        since it is a real-world problem.

        Larry
      • Larry Hamilton
        Peter, Thanks! Now there are six reg exps for what I want. That s a different challenge, who has the shortest? ;-) Larry ... From: Peter Stagg
        Message 3 of 19 , Jun 5 6:29 PM
          Peter,

          Thanks! Now there are six reg exps for what I want.

          That's a different challenge, who has the shortest? ;-)

          Larry

          ----- Original Message -----
          From: "Peter Stagg" <peter.stagg@...>
          To: <ntb-clips@yahoogroups.com>
          Sent: Wednesday, June 05, 2002 7:03 PM
          Subject: RE: [Clip] Regular Expression Question


          > Very succinct regex from Hugo
          >
          > This should also work:
          >
          > ^(\d+(\.|\/)?)+
        • silvermoonwoman2001
          ... Yes, but it also finds IP addresses ;)
          Message 4 of 19 , Jun 5 7:00 PM
            --- In ntb-clips@y..., "Larry Hamilton" <lmh@h...> wrote:

            > > Very succinct regex from Hugo
            > >
            > > This should also work:
            > >
            > > ^(\d+(\.|\/)?)+

            Yes, but it also finds IP addresses ;)
          • Larry Hamilton
            Sherri, Yes I tried, and both Hugo s and Peter s regexps do find IP addresses. They both also appear to find any pattern of numbers separated by periods. Try
            Message 5 of 19 , Jun 5 7:16 PM
              Sherri,

              Yes I tried, and both Hugo's and Peter's regexps do find IP addresses.

              They both also appear to find any pattern of numbers separated by periods.

              Try them on this string:


              169123.59.23.10.99.23.343

              Larry

              ----- Original Message -----
              From: "silvermoonwoman2001" <silvermoonwoman@...>
              To: <ntb-clips@yahoogroups.com>
              Sent: Wednesday, June 05, 2002 10:00 PM
              Subject: Re: [Clip] Regular Expression Question


              > --- In ntb-clips@y..., "Larry Hamilton" <lmh@h...> wrote:
              >
              > > > Very succinct regex from Hugo
              > > >
              > > > This should also work:
              > > >
              > > > ^(\d+(\.|\/)?)+
              >
              > Yes, but it also finds IP addresses ;)
              >
              >
              >
              >
              >
              > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
              >
              >
              >
            • Peter Stagg
              1) Yes, but only at the beginning of a line. 2) LH want s a regex to find dates at the beginning of a line and if he knows his files do not contain any other
              Message 6 of 19 , Jun 6 4:20 PM
                1) Yes, but only at the beginning of a line.
                2) LH want's a regex to find dates at the beginning of a line and if he
                knows his files do not contain any other strings of this kind at the
                beginning of a line then great.
                4) Yes, it also finds IP addresses! - reusable code!
                5) That's regex - it can be both a no.10 spanner and a monkey wrench -
                both will turn a no.10 nut but one will also turn a no.14 nut - depends
                how accurate you want to be and as NTs regex is not as advanced as say
                Perl's or others that have closures such that you can state exact
                numbers of items you want to find, I find the simpler more elegant
                solutions have to be a bit of a loose fit.

                > -----Original Message-----
                > From: silvermoonwoman2001 [mailto:silvermoonwoman@...]
                > Sent: Thursday, 6 June 2002 12:00 PM
                > To: ntb-clips@yahoogroups.com
                > Subject: Re: [Clip] Regular Expression Question
                >
                >
                > --- In ntb-clips@y..., "Larry Hamilton" <lmh@h...> wrote:
                >
                > > > Very succinct regex from Hugo
                > > >
                > > > This should also work:
                > > >
                > > > ^(\d+(\.|\/)?)+
                >
                > Yes, but it also finds IP addresses ;)
                >
                >
                > ------------------------ Yahoo! Groups Sponsor
                > ---------------------~--> Download VeriSign's FREE guide,
                > "Securing Your Web Site for Business" and learn everything
                > you need to know about using SSL to encrypt your e-commerce
                > transactions for serious online security. Click here!
                > http://us.click.yahoo.com/2tQ9vC/MyKEAA/sXBHAA> /dkFolB/TM
                >
                >
                > --------------------------------------------------------------
                > -------~->
                >
                >
                >
                > Your use of Yahoo! Groups is subject to
                > http://docs.yahoo.com/info/terms/
                >
                >
                >
                >
              • Alec Burgess
                Next year (v5.0 w/Perl) this works for dates only, not IP addresses) Right? ... should match: 05.1.3 words ... 05/06/83 words ... and maybe(not sure how this
                Message 7 of 19 , Jun 6 8:02 PM
                  Next year (v5.0 w/Perl) this works for dates only, not IP
                  addresses) Right?

                  >>>> ^(\d{1,2)(\.|\/)?){3}/w

                  should match:
                  05.1.3 words ...
                  05/06/83 words ...

                  and maybe(not sure how this would parse):
                  030498 or this
                  123 words ...

                  but not
                  1.3.4.6 words ...

                  or do I have round and curly brackets reversed?

                  Regards ... Alec

                  ---- Original Message ----
                  From: "Larry Hamilton" <lmh@...>
                  To: <ntb-clips@yahoogroups.com>
                  Sent: 05 June, 2002 22:16
                  Subject: Re: [Clip] Regular Expression Question

                  > Sherri,
                  >
                  > Yes I tried, and both Hugo's and Peter's regexps do
                  find
                  > IP addresses.
                  >
                  > They both also appear to find any pattern of numbers
                  > separated by periods.
                  >
                  > Try them on this string:
                  >
                  >
                  > 169123.59.23.10.99.23.343
                  >
                  > Larry
                  >
                  > ----- Original Message -----
                  > From: "silvermoonwoman2001"
                  <silvermoonwoman@...>
                  > To: <ntb-clips@yahoogroups.com>
                  > Sent: Wednesday, June 05, 2002 10:00 PM
                  > Subject: Re: [Clip] Regular Expression Question
                  >
                  >
                  >> --- In ntb-clips@y..., "Larry Hamilton" <lmh@h...>
                  wrote:
                  >>
                  >>>> Very succinct regex from Hugo
                  >>>>
                  >>>> This should also work:
                  >>>>
                  >>>> ^(\d+(\.|\/)?)+
                  >>
                  >> Yes, but it also finds IP addresses ;)
                  >>
                Your message has been successfully submitted and would be delivered to recipients shortly.