title: Detecting iOS Version Number from User Agent using Regular Expressions
body: <p>If I have an iOS user-agent like </p>
  
  <blockquote>
    <p>Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7</p>
  </blockquote>
  
  <p>or </p>
  
  <blockquote>
    <p>Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/7D11</p>
  </blockquote>
  
  <p>How would I detect the iOS version using regular expressions so that it would return e.g.</p>
  
  <blockquote>
    <p>4.0 </p>
  </blockquote>
  
  <p>for the above user agent?</p>