I need to parse some information from lines of texts that follow a certain formatting layout. This is an example of how the text file would look:
A. This is option a C. This is option c
B. This is option b D. This is option d
At the end of the day, all I want is that after parsing the above two lines, I would then have on my C# code:
string OptionA = "This is option a";
string OptionB = "This is option b";
string OptionC = "This is option c";
string OptionD = "This is option d";
The space between A. and C. (or B. and D.) could either be a tab (\t) or a random number of white spaces. When stepping through the code and the line is read, this is how it looks:
"A.\tThis is option a\tC. This is option c"
Or it may look like this
"A.\tThis is option a C. This is option c"
I probably need some help splitting this line based on “\t” or a number of white spaces preceeding “C.” as in the case of the above example.
Any inputs would be greatly appreciated.
The following regex should do it,
Where for each line