title: javascript - regex matching devices on user agent
body: <p>I'm using the PHP class "Mobile Detect" to detect user device type (tablet/phone) however I also want to detect certain devices in javascript. Can someone help me convert the following into javascript regex (just need a true/false return)?</p>
  
  <pre><code>var user_agent = navigator.userAgent;
  
  var samsung = 'Galaxy.*Tab|SAMSUNG.*Tablet|Galaxy.*Tab|Android.*GT-';
  // if statement checking samsung regex against user agent
  
  var nexus = '^.*Android.*Nexus(((?:(?!Mobile))|(?:(\s(7).+))).)*$';
  // if statement checking nexus7 regex against user agent
  </code></pre>