[英]Regex - User Agent for all mobile browsers apart from safari
Could anyone help me with a regexExp for targeting all mobile browsers apart from safari? 有人可以用regexExp来帮助我定位safari以外的所有移动浏览器吗? saw this online but its turning out not to be that helpful
在网上看到了这个,但结果却没有那么大的帮助
^(?:.*Windows Phone.*|.*WPDesktop.*|.*RIM.*|.*BlackBerry.*|.*Opera Mini.*|.*Opera Mobi.*|.*Silk\\/.*|.*Kindle.*|.*Android.*|(?!.*?(?:iPhone)).*?Mobile.*|.*Symbian.*)$
You can try this regex: 您可以尝试以下正则表达式:
(?:(?!Safari).)*
It includes everything but Safari. 它包括Safari之外的所有内容。 Examples:
例子:
String s1 = "My browser is Safari.";
boolean res1 = s1.matches("(?:(?!Safari).)*"); // res1 = false
String s2 = "My browser is Opera.";
boolean res2 = s2.matches("(?:(?!Safari).)*"); // res2 = true
Have a look to this answer for more info: https://stackoverflow.com/a/977290/1827254 请查看此答案以获取更多信息: https : //stackoverflow.com/a/977290/1827254
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.