I have an multiline input string of following format
ID | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 | Col7 | Col8
The data might run into thousands of rows
Data Type for Col1-8 could be alphanumeric or alpha only which may differ from row to row.
I need to do following:
-
Extract Col2 & Col3 out (Thinking of using Regex here instead of usual string splitting since later would be slower in my case?)
-
I want the rest of the data also in following format also. ID | Col1 | Col4 | Col5 | Col6 | Col7 | Col8 (This I can achieve using string.Replace once I have the data in point 1)
Please note that I do not want to loose data of Col2 & Col3 while achieving solution for point 2 and hence the first point is also important to me.
I tried creating RegEx for point 1 as (|){2,4} which I understand now is completely wrong and curently I have no idea how to proceed on this using Regex.
I would be thankful for any help/pointers on how to go about creating a regex for same.
Is there a reason you can’t do it this way?