What is the regular expression that matches basically all browser useragent and the main search engine spider?

Source: Internet
Author: User
Keywords Php user-agent regular expressions search engines
Implementing the UA Whitelist with PHP requires the ability to match basically all browsers and the main search engine spider UA Regular.
Maybe this is a complicated question, and I'll see if anyone can solve it.

Reply content:

Implementing the UA Whitelist with PHP requires the ability to match basically all browsers and the main search engine spider UA Regular.
Maybe this is a complicated question, and I'll see if anyone can solve it.

var userAgent = navigator.userAgent.toLowerCase();// Figure out what browser is being usedjQuery.browser = {    version: (userAgent.match( /.+(?:rv|it|ra|ie)[/: ]([d.]+)/ ) || [])[1],    safari: /webkit/.test( userAgent ),    opera: /opera/.test( userAgent ),    msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),    mozilla: /mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};

For your reference, http://www.bkjia.com/jQuery/449138.html.
Improve the other two clue ideas,
1. In the earliest implementation of jquery, the detection of UA seems to be the use of regular expression detection, and later the compatibility code is "testing" the way;
2. JavaScript advanced programming, the impression is that there is such a code, the third version of the sample code on 233 pages

Add:
This site can be found in the vast majority of browsers and search engine spider ua:http://www.useragentstring.com/pages/useragentstring.php
UA description for IE: https://msdn.microsoft.com/en-us/library/ms537503 (v=vs.85). aspx
The UA description for Firefox: https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
UA Note for Chrome: https://developer.chrome.com/multidevice/user-agent

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.