This is a good idea but not very fool proof. If Google decided to change something minor in their layout it could easily break. For example the <font> tag.
I think the regular expression should be rewritten to search for the contents of <div id=res> and then strip out any tags that isn't an <a> tag then return the contents of the <a>. At the moment it relies on the font tag being set to that red colour Google uses.