Plz help me usecase

hi i have a input text file
attaching below … using only regex i want output in an excel like this iam attaching image below
OCR Output.txt (1.7 KB)

Hi,

Can you try the following sample?

mc = System.Text.RegularExpressions.Regex.Matches(strPartial,"^(?<ITEMS>\d+)\s+(?<DESCRIPTION>.+?)\s+(?<QTY>[\d.,]+)\s+(?<UNITPRICE>[\d.,]+)\s+(?<NETAMOUNT>[\d.,]+)\s*$",System.Text.RegularExpressions.RegexOptions.Multiline)

dt = mc.Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) dt.LoadDataRow(arrGrp.Select(Function(s) m.Groups(s).Value).ToArray(),False)).CopyToDataTable

Sample20230616-5L.zip (4.0 KB)

Regards,

Hi ,

I hope this will help you,
Items=System.Text.RegularExpressions.Regex.Match(“InputData”,“(?<=\n)\d{6}(?=\s[A-Z]+)”).Value
Description=System.Text.RegularExpressions.Regex.Match(“InputData”,“[A-Z]+/[A-Z]+-[A-Z]+(?=\s\d+)”).Value
Qty=System.Text.RegularExpressions.Regex.Match(“InputData”,“(?<=[A-Z]\s)\d+.\d{2}”).Value
Unitprice=System.Text.RegularExpressions.Regex.Match(“InputData”,“(?<=\d{2}\s)\d+,*\d+.\d+(?=\s\d+,)).Value
NetAmount=System.Text.RegularExpressions.Regex.Match(“InputData”,”(?<=.\d{2}\s)\d+,\d+.\d{2}(?=\s\d{5})).Value

Thank you.

Hello @katta_nikhil
Refer to this Flow you may get some idea
TextToDatatable.zip (152.3 KB)

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