Port of BrowserScope's user agent string parser