Hey,
I want to use the ereg function to find MSIE followed by any number between 0 and 7.0. For instance MSIE 5.01. What would be the valid regular expression for this?
Thanks in advance,
Olii
Hey,
I want to use the ereg function to find MSIE followed by any number between 0 and 7.0. For instance MSIE 5.01. What would be the valid regular expression for this?
Thanks in advance,
Olii
REMOVED
Edited by jesus (Forum Super Moderator): Please do not have text in your signature which is over size 4.
Not tested, may not work.PHP Code:<?php
$input = "MSIE 5.01";
$eimput = explode(" ", $input)
$num = $eimput[1];
ereg ("([0-7]{1}).([0-99]{2,1})", $num, $finout);
echo "Returned: ";
echo $finout[1];
echo ".";
echo $finout[2];
?>
Last edited by Tomm; 21-10-2006 at 08:00 PM.
Nope![]()
Parse error: syntax error, unexpected T_VARIABLE in /home/shake/public_html/Tom/index.php on line 4
Try:
PHP Code:<?php
$input = "MSIE 5.01";
$eimput = explode(" ", $input)
$num = $eimput[1];
if(ereg ("([0-7]{1}).([0-99]{2,1})", $num, $finout)){
echo "Returned: ";
echo $finout[1];
echo ".";
echo $finout[2];
}
?>
Last edited by Tomm; 22-10-2006 at 07:30 AM.
Want to hide these adverts? Register an account for free!