random1 Posted September 28, 2009 Share Posted September 28, 2009 I have the following code working: <?php if ( ereg('[0-9]*\.*[0-9]*', $version_number, $m ) ) { $math_version_number = $m[0]; //print_r($m); } ?> But in the Apache error log it displays: PHP Deprecated: Function ereg() is deprecated I then change it to the latest 'preg_match' function and try it and I get: PHP Warning: preg_match() [function.preg-match0]: Unknown modifier '*' in __________ How do you do a wildcard '*' in preg_match()? Link to comment https://forums.phpfreaks.com/topic/175761-solved-fixing-deprecated-ereg-to-preg_match-function/ Share on other sites More sharing options...
random1 Posted September 28, 2009 Author Share Posted September 28, 2009 I finally found out: preg_match('/[0-9]*\.*[0-9]*/', $version_number, $m ) works. You need to wrap it in forward slashes. Link to comment https://forums.phpfreaks.com/topic/175761-solved-fixing-deprecated-ereg-to-preg_match-function/#findComment-926211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.