I have this data in format
"NEW ITEM:1_BELT:3_JEANS:1_BELT:1_SUIT 3 PCS:1_SHOES:1"
the format is Item1:Item1Qty_Item2:Item2Qty.........ItemN:ItemNQty
I need to separte the the items and their corresponding quantities and form arrays. I did the item part like this..
var allItemsAry = Regex.Replace(myString, "[\\:]+\\d", "").Split('_');
Now allItemsAry
is correct like this [NEW ITEM, BELT, JEANS, BELT, SUIT 3 PCS, SHOES]
But I can't figrure out how to get qty, whatever expression I try that 3
from SUIT 3 PCS
comes along with that, like these
var allQtyAry = Regex.Replace(dataForPackageConsume, "[^(\\:+\\d)]", "").split(':')
This comes up as :1:3:1:13:1:1
(when replaced). So I can't separate by :
to get make it array, as can be seen the forth item is 13
, while it should be 1
, that 3
is coming from SUIT 3 PCS
. I also tried some other variations, but that 3
from SUIT 3 PCS
always pops in. How do I just get the quantities of clothes (possible attached with :
so I can split them by this and form the array?
UPDATE : If I didn't make it clear before I want the numbers that are exactly preceded by :
along with the semicolon.
So, what I want is :1:3:1:1:1:1.