Use a regexp to test user agent strings

 * Suggested in
   https://trac.torproject.org/projects/tor/ticket/9041#comment:9