How would you parse in Java a structure, similar to this
\\Header (name)\\\ 1JohnRide 2MarySwanson 1 password1 2 password2 \\\1 block of data name\\\ 1.ABCD 2.FEGH 3.ZEY \\\2-nd block of data name\\\ 1. 123232aDDF dkfjd ksksd 2. dfdfsf dkfjd .... etc
Suppose, it comes from a text buffer (plain file).
Each line of text is "\n" - limited. Space is used between the words.
The structure is more or less defined. Ambuguity may sometimes be, though, case number of fields in each line of information may be different, sometimes there may not be some block of data, and the number of lines in each block may vary as well.
The question is how to do it most effectively?
First solution that comes to my head is to use regular expressions.
But are there other solutions? Problem-oriented? Maybe some java library already written?