A library named TextFinder has been added to the playground that enables extracting information from a stream of data. It was created to be used with the Arduino Ethernet library to find particular fields and get strings or numeric values. I can also be used with Serial data.
To use TextFinder, you create an 'instance' for the stream you want to processes. For example, the following fragment is based on the Ethernet client example sketch distributed with Arduino. That sketch does a google search on the term arduino. The following adds functionality to print the number of hits reported by google.
Add these lines before setup:
TextFinder finder( client );
Modify the connection code as follows:
finder.find("Results <b>"); // seek to the Results field
finder.find("of about <b>"); // skip past this
long value = finder.getValue(); // get numeric value
The remainder of the sketch can be as in the distributed example. The find method reads data from the client until it finds the string: "Results <b>"
It then looks for the string: "of about <b>"
And the getValue method returns the next numeric value.
See the playground for more details: http://www.arduino.cc/playground/Code/TextFinder