#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Cool Regex Help - string include numbers


    PA1\*\*?([^\*]+)\*[\d]*[\D]*PA2[\*]*([0-9]+)+

    the problem is that they want to send in "Product Name" numbers also.

    PA1*46*10
    PA2*0*0*0*0
    PA1*0*200*HARD CARDIO TRAINING
    PA2*17*3400*0*0
    PA3*0*0*0*0
    PA4*5*1000*0*0
    PA5*100523*1032
    PA1*1*250*STANDARD PAPA ROTEIN MIX
    PA2*87*21750*4*1000
    PA3*0*0*0*0
    PA5*100525*1926
    PA1*2*300*Power 1.5 KG PROTEIN MIX
    PA2*42*12600*1*300
    PA3*0*0*0*0
    PA4*1*300*0*0
    PA5*100525*1941
    PA1*1*45
    PA2*63489
    PA1*2*225
    PA2*21859
    PA1*46*10
    PA2*0*0*0*0
    what you can advice me?
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,996
    Rep Power
    9397
    Ugh.
    Code:
    PA1\*(\d+)\*(\d+)(?:\*(.*))?\s+PA2\*(\d+)\*(\d+)\*(\d+)\*(\d+)
    That gets you the two numbers on the PA1 line, whatever label might be there too, and the four numbers on the next PA2 line.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Thanks. It helped me a lot.


    Originally Posted by requinix
    Ugh.
    Code:
    PA1\*(\d+)\*(\d+)(?:\*(.*))?\s+PA2\*(\d+)\*(\d+)\*(\d+)\*(\d+)
    That gets you the two numbers on the PA1 line, whatever label might be there too, and the four numbers on the next PA2 line.
    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo