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.
