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

Re: [Clip] Regular Expression Question

Expand Messages
  • 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 1 of 19 , Jun 5, 2002
    • 0 Attachment
      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 2 of 19 , Jun 6, 2002
      • 0 Attachment
        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 3 of 19 , Jun 6, 2002
        • 0 Attachment
          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.