John, If you are on Java 5 (and this isn't a school project), you can use the Scanner class. If not, you'll have to read the lines of the file yourself. Either way, you need to figure out how to express what you want to match in Java.
If you share which approach you plan to take (scanner vs read file), you may get some more concrete advice.
You can get NosuchElementExceptions if the Scanner tries to read more lines than there are in the text file. Remember there are Scanner methods for reading all sorts of different data types directly from text.