title: RegExp uncaught TypeError: Cannot read property '1' of null
body: <p>I found this code;</p>
  <p><code>navigator.appVersion.match(/MSIE ([\d.]+)/)[1];</code></p>
  <p>For detecting browser version. This code works in IE 8 below but not on google chrome. The error in google chrome says;</p>
  <p><code>Uncaught TypeError: Cannot read property '1' of null</code></p>
  <p>and it points to the line where this code belongs;</p>
  <p><code>navigator.appVersion.match(/MSIE ([\d.]+)/)[1];</code></p>
  <p>Any idea how to fix this issue?</p>
  <hr />
  <p>just to make things clear what i'm trying to accomplish here is to detect the browser version:</p>
  <pre><code>var version = navigator.appVersion.match(/MSIE ([\d.]+)/)[1];
  
  if(version &lt;= 8.0)
  
  {
     execute code;
  }
  </code></pre>
  <p>Everything works fine in IE but I got an error in google chrome which is:</p>
  <p><strong>Uncaught TypeError: Cannot read property '1' of null</strong></p>
  <p>and it points to the line where this code belongs;</p>
  <p><strong>navigator.appVersion.match(/MSIE ([\d.]+)/)[1];</strong></p>