Not getting the desired values

Line Item Information5 ItemsCollapse allDescending1
Item1
GTIN123456.78901235
TPNDACDVFBGTYHIJIJK67890123456789012345
ProductDescriptionPFILOUS MOUSSE 4X71G123456789012345
QtyOrderedText1.23456789011234
QtyDeliveredText3333333.33333334
UOM
ConsumerUnitText100000000000.000
QtyReceivedText99.9999999999999
UOM_1
QtyDifferenceText1231231.23123123
StatusOver Shipped
DiscrepancyCodePartial Shipment
ChangeDescriptionSHORT678901234567890123456789012345 Item #GTIN TPND Product DescriptionQty OrderedQty DeliveredUOM Consumer UnitsQty ReceivedUOM Qty DifferenceStatus Discrepancy CodeChange DescriptionQty Charged2
Item2
GTIN11.2599
TPNDACDVFBGTYHIJIJK67890123456789012345
ProductDescriptionPFILOUS MOUSSE 4X71G123456789012345
QtyOrderedText18.995
QtyDeliveredText9.566
UOM
ConsumerUnitText10.25
QtyReceivedText11.26
UOM_1
QtyDifferenceText102.58
StatusOver Shipped
DiscrepancyCodePartial Shipment
ChangeDescriptionSHORT678901234567890123456789012345 Item #GTIN TPND Product DescriptionQty OrderedQty DeliveredUOM Consumer UnitsQty ReceivedUOM Qty DifferenceStatus Discrepancy CodeChange DescriptionQty Charged3
Item3
GTIN33297794900181
TPNDACDVFBGTYHIJIJK67890123456789012345
ProductDescriptionPFILOUS MOUSSE 4X71G123456789012345
QtyOrderedText123456789012345
QtyDeliveredText123456789012345
UOM
ConsumerUnitText123456789012345
QtyReceivedText123456789012345
UOM_1
QtyDifferenceText123456789012345
StatusOver Shipped
DiscrepancyCodePartial Shipment
ChangeDescriptionSHORT678901234567890123456789012345 Item #GTIN TPND Product DescriptionQty OrderedQty DeliveredUOM Consumer UnitsQty ReceivedUOM Qty DifferenceStatus Discrepancy CodeChange DescriptionQty Charged4
Item4
GTIN33297794900181
TPNDACDVFBGTYHIJIJK67890123456789012345
ProductDescriptionPFILOUS MOUSSE 4X71G123456789012345
QtyOrderedText123456789012345
QtyDeliveredText123456789012345
UOM
ConsumerUnitText123456789012345
QtyReceivedText123456789012345
UOM_1
QtyDifferenceText123456789012345
StatusOver Shipped
DiscrepancyCodePartial Shipment
ChangeDescriptionSHORT678901234567890123456789012345 Item #GTIN TPND Product DescriptionQty OrderedQty DeliveredUOM Consumer UnitsQty ReceivedUOM Qty DifferenceStatus Discrepancy CodeChange DescriptionQty Charged5
Item5
GTIN33297794900181
TPNDACDVFBGTYHIJIJK67890123456789012345
ProductDescriptionPFILOUS MOUSSE 4X71G123456789012345
QtyOrderedText123456789012345
QtyDeliveredText123456789012345
UOM
ConsumerUnitText123456789012345
QtyReceivedText123456789012345
UOM_1
QtyDifferenceText123456789012345
StatusOver Shipped
DiscrepancyCodePartial Shipment
ChangeDescriptionSHORT678901234567890123456789012345 Item #GTIN TPND Product DescriptionQty OrderedQty DeliveredUOM Consumer UnitsQty ReceivedUOM Qty DifferenceStatus Discrepancy CodeChange DescriptionQty Charged10 per page5 results
1 of 1
PalletPallet 12&!#
SSCC CodeRECIEVEADVICE 123456789ABCDEFGHIJKL Pallet #SSCC Code

I am using this regex (GTIN)(?.+)(?(?=Item)) to get the values of the labels but i am also getting some unwanted noise data.
Help me to remove that part and if it is possible to get the generalize form
GTIN is a label like that item, uom these all are different labels

@ajindal

It wpuld be good if you can highlight the data you need from input and tell us few parts of string which will not change

Cheers

Thanks for the reply

I want like
when i put label as item it should have output 1 2 3
For GTNIN 123456.78901235 11.2599
that like many labels are there and i want label values

these are kind of several line items having same label names but different values


Here i have to get only label values not noise.

Hi @ajindal ,

Not so sure what is meant by noise here, But maybe you can check with the below Regex :

(?<=Item?[\S\s]+?GTIN\s*)[\d.,]+

If this is not the output that was required, maybe you can provide us more detail on what needs to be chosen as the correct values.

@ajindal

Please try this

"(?<=GTIN)[\d\.]+"

"(?<=Item)\d+"

Cheers

This is throwing error for me

Thanks for the help but the regex expression will need to change every time
Label name will change but apart from the label name can it be generalize as for GTIN decimal point is there item is having digits and some labels are having alphabets as weel as space.

H! @ajindal ,

You can try this:

strGTIN = System.Text.RegularExpressions.RegEx.Match(YourInputVariable,"(?<=[GTIN]{4})[A-Za-z0-9]{1,}+.*[A-Za-z0-9]{0,}").ToString.Trim

Reference:

Regards,
NaNi

@ajindal

If we generalize more then it would take unnecessary values as well…so its good and idea of regex is to use depending on rules…

Because as you mentioned also for different labels it would be different …so its ideal to write it separate

Cheers