halosinfire Posted June 1, 2013 Share Posted June 1, 2013 I've never quite understood the syntax of preg_replace and now I need to convert the following line of code from ereg_replace to preg_replace because ereg_replace is deprecated. Can anyone help? $qstr = ereg_replace("&page=[0-9]+","",$_SERVER['QUERY_STRING']); Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/278654-change-ereg_replace-to-preg_replace-syntax/ Share on other sites More sharing options...
requinix Posted June 1, 2013 Share Posted June 1, 2013 For a lot of expressions all you need to do is add delimiters. Most anything will do but / and # are most common. /&page=[0-9]+/For eregi methods use the /i flag like /&page=[0-9]+/i. Link to comment https://forums.phpfreaks.com/topic/278654-change-ereg_replace-to-preg_replace-syntax/#findComment-1433511 Share on other sites More sharing options...
halosinfire Posted June 1, 2013 Author Share Posted June 1, 2013 Thank you very much requinix, that works perfects =) Link to comment https://forums.phpfreaks.com/topic/278654-change-ereg_replace-to-preg_replace-syntax/#findComment-1433515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.