preg match for Safari
Posted: Tue Aug 23, 2005 10:33 am
I am trying to get a preg_match for 'Safari', but the following doesn't seem to work, anyone see my mistake?
The input is 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412.6.2 (KHTML, like Gecko) Safari/412.2.2'
Thanks in advance
The input is 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412.6.2 (KHTML, like Gecko) Safari/412.2.2'
Code: Select all
if ( preg_match("/Safari ([0-9]\.[0-9]{0,2})/i", $this->get_user_agent(), $found) &&
strstr($this->get_user_agent(), "Mozilla") )
{
$this->browser = "Safari " . $found[1];
}