I want to parse the line as this,
S1,F2 title including several white spaces (abbr) single,Here<->There,reply
And I want the output as below,
1
2
title including several white spaces
abbr
single
Here22There # identify <-> and translate it to 22;
reply
I am wondering how to parse the line above?
Method 1.
I plan to split the whole line to four segments then parse the individual sub segments.
segment1. S1,F2
segment2. title including several white spaces
segment3. abbr
segment4. single,Here<->There,reply
Method 2.
I just write a complex regular expression statement to parse it.
Which method is more make sense for my practice?
Appreciated on any comments or suggestions.
Assuming your input be in the format specified you could use a regex like:
Codepad link