I'm trying to create a parser in Java that would help me to get some details from a text file.
The data in the file looks like this, but with more entries:
.
http://www.someurl1.com/
PERSONAL ADDRESS: Mozart, W.A.; Some address 1, Austria; email: [email protected]
.
http://www.someurl2.com/
PERSONAL ADDRESS: Beethoven, L.V.; Some address 2, Germany; email: [email protected]
As you can see, the data always respects a pattern, and what I would like to get is just the name and the e-mail for every entry. A possible good output would be this:
Mozart, W.A. ; [email protected]
Beethoven, L.V. ; [email protected]
Every entry starts with a . followed by a space in the first line. Then in the next line above the dot, there's the URL. In the following line, there's more data: name, address and e-mail, all separated by a ;.
This isn't hard but I'm having some troubles starting. I've created a Main class in which I read the text file to a String. But then I really don't know what's the best way to parse something like this in Java, if I should try to use regular expressions or just get looking for the ;.