Well, we're in advanced so I'll bring up Regular Expressions. You can compile a Pattern object then use its methods to get a Matcher for your input string and use find() and group() methods to get what was found. I hope that used just enough of the right words to get you started in the JavaDoc. Holler if you'd like examples. I have something almost exactly like what you need.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Always look on the bright side of life. At least this ad is really tiny: