How would you split Regex subexpression matches in to multi-dimensional string arrays?
I have a "myvar" string of:
1-4:2;5-9:1.89;10-24:1.79;25-99:1.69;100-149:1.59;150-199:1.49;200-249:1.39;250+:1.29
which is a repeat of QuantityLow - QuantityHigh : PriceEach ;
I used this "myreg" Regex /(\d+)[-+](\d*):(\d+\.?\d*);?/g
Used it with var myarray = myvar.match(myreg);
that produced:
myarray[0] = "1-4:2;"
myarray[1] = "5-9:1.89;"
myarray[2] = "10-24:1.79;"
myarray[3] = "25-99:1.69;"
myarray[4] = "100-149:1.59;"
myarray[5] = "150-199:1.49;"
myarray[6] = "200-249:1.39;"
myarray[7] = "250+:1.29"
Fantastic! Except that I need the strings broken further by the Q1 - Q2 : P as noted above. The regex is already setup to identify the parts with parenthesis. I would think this could be done with a single Regex expression, or at least two, rather than setting up some sort of loop.
Thanks for the feedback.