Well it didn't take long to come up with another query!
The varable $HTTP_ENV_VARS['HTTP_USER_AGEN T']
returns on my browser:
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)'
I have to write a PHP script that check to see if it contains MISE and
confirm whether the browser being used is Internet Explorer and what
version.
The first part is easy.
I now need to isolate "6.0" from the string. I have tried many combinations
of "regexp" but none have come even close to finding the string of
characters that start at the beginning and end with MSIE, followed by a
space, thus:
"'Mozilla/4.0 (compatible; MSIE "
The code I am trying to use is:
$search = $HTTP_ENV_VARS['HTTP_USER_AGEN T'];
if ( ereg( "^([a-zA-Z0-9\(\)\.\/\;\'\s])*4.0[[:>:]]", $search,$match ) ) {
print( "String found ending in 'IE': " .$match[ 1 ] . "<br />" );
}
I would then need to replace this with "" and select all characters up to
but not including ";"
I would welcome any advice you can offer.
TIA
Roger
The varable $HTTP_ENV_VARS['HTTP_USER_AGEN T']
returns on my browser:
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)'
I have to write a PHP script that check to see if it contains MISE and
confirm whether the browser being used is Internet Explorer and what
version.
The first part is easy.
I now need to isolate "6.0" from the string. I have tried many combinations
of "regexp" but none have come even close to finding the string of
characters that start at the beginning and end with MSIE, followed by a
space, thus:
"'Mozilla/4.0 (compatible; MSIE "
The code I am trying to use is:
$search = $HTTP_ENV_VARS['HTTP_USER_AGEN T'];
if ( ereg( "^([a-zA-Z0-9\(\)\.\/\;\'\s])*4.0[[:>:]]", $search,$match ) ) {
print( "String found ending in 'IE': " .$match[ 1 ] . "<br />" );
}
I would then need to replace this with "" and select all characters up to
but not including ";"
I would welcome any advice you can offer.
TIA
Roger
Comment