Any RegEx experts around?


Code Monkey
Staff member
Hopefully one of you guys/gals with stronger RegEx skills can help out with this one......

Re: User Agent Strings - Google Chrome

Using the user agent string of the browser, is there of a quick way of detecting that it is an Android Webview? Using the link above Google says that in modern iterations of Android the string should be something like...

Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML,like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36​

... and that webview can be detected by looking for both the presence of Chrome/{ver} and "wv" as part of the device identifier (shown in red above).

Detecting the Chrome/{rev} should be easy enough but what about detecting the presence of the "wv"?

Is there a nice little function out there somewhere already (either JS or JQuery or *cough* CFML *cough*) that detects it? I've been searching and finding some stuff for PHP and similar but not plain JS or JQuery. There are plenty of functions out there to detect Android (tablets) or Android Mobile (phones) but they don't go the extra step of also looking for webview.