How to Keep Some Lines from set of Lines Based on Condition?

Hi,

Can you try the following sample?

mc = System.Text.RegularExpressions.Regex.Matches(strData,"(?<FirstLine>Node_.*?)\r?\n(?<SecondLine>.*?)\r?\n([^:]*?\r?\n)*(?<ThirdLine>.*?)(\r?\n|$)([^:]*?\r?\n)*(?=Node_|$)")

dtResult = mc.Cast(Of Match).Select(Function(m) dtResult.LoadDataRow({m.Groups("FirstLine").Value,m.Groups("SecondLine").Value,m.Groups("ThirdLine").Value},False)).CopyToDataTable()

Sample20220213-2.zip (3.0 KB)

Regards,

1 Like