Broke out the regexp searches into a sub, so we can easily use the same
stuff with lwp/wget/curl.

Signed-off-by: Elliot Voris <elliotfriend@gmail.com>