Im trying to pull the Mozilla version and *possibly* the MSIE x.xx string out $_SERVER['HTTP_USER_AGENT']
If I did this correctly, (MSIE\s\d\.\d{1,2})? should mean that if its there pull it out, else move on, since its not there.
When viewing this script via a windows browser, it doesn't match the MSIE section. If I take out the trailing ?, it will match successfully.
But when viewing it with a mozilla browser, the regex fails as there is not MSIE string in there.
Any help with this would be appreciated.
Thanks


<?php

var_dump($_SERVER['HTTP_USER_AGENT']);
echo '<p>';
preg_match('/^(Mozilla\/\d\.\d{1,2}|Opera\/\d\.\d{1,2})\s\(.*?(MSIE\s\d\.\d{1,2})?.*?\)(\sOpera)?/', $_SERVER['HTTP_USER_AGENT'], $foo);


var_dump($foo);

?>


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to