Parsing a text into multiple lines on array of strings

Hello Everyone,
I am a beginner in RPA. I am having following requirement

input file : having 6 million records / EACH ROW is 22800 bytes long
00HD01…HEADER .12/13/2019.2019347.00095726.12/13/2019.2019347.091001MST33… . 5918107036090000504MTHO… . 5918107036090000515918107036090000516663360900001005CHKP

Search strings :
00HD01
01MST3
04MTHO
05CHKP

if any one of the strings find need to break the line and start writing in the next line until next found. The string can be in same line or on multiple lines. If it’s multiple lines i need to concatenate as a single line

so output should be like
00HD01…HEADER .12/13/2019.2019347.00095726.12/13/2019.2019347.0910
01MST33… . 59181070360900005
04MTHO… . 59181070360900005159181070360900005166633609000010
05CHKP

is there any way to achieve this? Please help me out…

Hi,

Can you try the following?

result = System.Text.RegularExpressions.Regex.Matches(strData.Replace(vbCrLf,""),"(00HD01|01MST3|04MTHO|05CHKP).*?(?=$|00HD01|01MST3|04MTHO|05CHKP)")

The result variable is MatchCollection type, so you need to use For Each Activity etc. to extract and concatenate them.

Regards,