Hi Team, I need solution for this, if the text contains (content of) then i need 47,76 from this line (Price (Gross) 1 PC 47,76 )

10-20 934190904 HENG CAOPIDGE AIR HEAIOR
6 PC 47,76/1 286,56
Price (Gross) 1 PC 47,76
Order no.: 50093634
content of 934190906
Confirmed Delivery date 03.05.2023


10-30 834190905 INSULATING Mark HEATING CARTRIDGE
6 PC 21,21/1 127,26
Price (Gross) 1 PC 21,21
Order no.: 50093634
content of 934190906
Confirmed Delivery date 03.05.2023


40 929404076 MAINTE MCKAGE PLKLOEUMATIK
1 PC 301,96/1 301,96
Price (Gross) 1 PC 301,96
Order no.: 50093634/20
Confirmed Delivery date 23.01.2023

@Midhila_Gurram

How is this data stored? Is it in a datatable or some other source?

Thanks,
Srini

Hi,

How about the following sample?

mc = System.Text.RegularExpressions.Regex.Matches(yourString,"Price \(Gross\) 1 PC (?<VALUE>[\d.,]+)\s*\n(\S.*\n)*content of")

Then, iterate mc using ForEach

currentItem.Groups("VALUE").Value

note: mc is MatchCollection type

Sample20230417-4L.zip (2.7 KB)

Regards,

Hi @Midhila_Gurram , we can use string manipulation or regex as well to extract those 2 values. Let me know if you need solution for the same

I am reading from text file and want to store in list

Can you try the following?

mc = System.Text.RegularExpressions.Regex.Matches(yourString,"Price \(Gross\) 1 PC (?<VALUE>[\d.,]+)\s*\n(\S.*\n)*content of")

Then

mc.Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Groups("VALUE").Value).ToList()

Sample20230417-4Lv2.zip (2.7 KB)

Regards,

@Midhila_Gurram , if “PC” is fixed in the input string then simple use extract between from the snippets to capture the values and then split again with “,” to get as array

Thank you, this is working,.

1 Like

Can You help me to get 286.56 and 127,26 into list,.

HI,

How about the following?

mc = System.Text.RegularExpressions.Regex.Matches(yourString,"(?<VALUE2>[\d.,]+)\s*\nPrice \(Gross\) 1 PC (?<VALUE>[\d.,]+)\s*\n(\S.*\n)*content of")

Sample20230417-4Lv3.zip (2.7 KB)

Regards,

1 Like

Thank you,.

@Midhila_Gurram

If you able to resolve your issue, please close this thread by clicking Mark as solution to appropriate post

Thanks,
Srini

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.