title: Detecting Chrome OS with Javascript
body: <p>I want to detect Chrome OS with Javascript, and I'm using <code>navigator.userAgent</code> for this. Now, I'm running Chrome OS, and my navigator userAgent is </p>
  
  <pre><code>Mozilla/5.0 (X11; CrOS armv7l 6680.78.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.102 Safari/537.36
  </code></pre>
  
  <p>Now. I used Regular Expressions to check for the style of the userAgent, and wrote the code below. </p>
  
  <pre><code>&lt;script&gt;
      if ( navigator.userAgent = /^Mozilla\/\d{1}^.\d{1}^(X11; CrOS i\d{3} \d{1}^.\d{2}\d{3} ^AppleWebKit\/\d{3}^.\d{2} ^(KHTML, like Gecko) Chrome\/ \d{2}^.\d{1}^.\d{3}^.\d{2} ^Safari\/\d{3}^\d{2}/ ){
        console.log(navigator.userAgent);
      } else {
        console.log(navigator.userAgent);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Now, upon loading this Script, I get an error.</p>
  
  <pre><code>Uncaught SyntaxError: Invalid regular expression: /^Mozilla\/\d{1}^.\d{1}^(X11; CrOS i\d{3} \d{1}^.\d{2}\d{3} ^AppleWebKit\/\d{3}^.\d{2} ^(KHTML, like Gecko) Chrome\/ \d{2}^.\d{1}^.\d{3}^.\d{2} ^Safari\/\d{3}^\d{2}/: Unterminated group
  </code></pre>
  
  <p>What is wrong here with my code?</p>