Regular Expression - Numbers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    Regular Expression - Numbers

    I'm trying to come up with a regular expression that matches numbers with commas... but doesn't match numbers formatted without commas. The problem is that I'm trying to parse a file where the columns run together sometimes. For example

    987,456,321123, 456,78

    This matches for the following regular expression
    [-+]?(\d|,)*\.?\

    What I'd like to to is only match up to three numbers between commas so that the preceding example would come back as two separate matches. I don't have a lot of experience with regular expressions and I haven't been able to find anything that does what I want. I'm hoping someone can help me. Thanks in advance

    Mike
  • Mike

    #2
    RE: Regular Expression - Numbers

    Well, figured it out. I do appreciate the veritable glut of responses, though....

    Comment

    • Mike

      #3
      RE: Regular Expression - Numbers

      Well, figured it out. I do appreciate the veritable glut of responses, though....

      Comment

      • Steve McLellan

        #4
        Re: Regular Expression - Numbers

        Always best to get it yourself! :-)

        I presume you're using [2] instead of * now, but I found this site useful
        when I was doing regexs a lot


        Steve

        "Mike" <anonymous@disc ussions.microso ft.com> wrote in message
        news:2EA99008-DC7F-4F21-B07C-7CBDA969202A@mi crosoft.com...[color=blue]
        > Well, figured it out. I do appreciate the veritable glut of responses,[/color]
        though....


        Comment

        • Steve McLellan

          #5
          Re: Regular Expression - Numbers

          Always best to get it yourself! :-)

          I presume you're using [2] instead of * now, but I found this site useful
          when I was doing regexs a lot


          Steve

          "Mike" <anonymous@disc ussions.microso ft.com> wrote in message
          news:2EA99008-DC7F-4F21-B07C-7CBDA969202A@mi crosoft.com...[color=blue]
          > Well, figured it out. I do appreciate the veritable glut of responses,[/color]
          though....


          Comment

          Working...