ballhogjoni Posted July 11, 2008 Share Posted July 11, 2008 I keep getting this error: Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 $referer = $_SERVER['HTTP_REFERER']; $urlparsed = parse_url($referer); extract($urlparsed); $newquery = trim(substr(strstr($query, "&q="),3),'&q='); $keyword = preg_replace('/+/',' ',$newquery); Quote Link to comment https://forums.phpfreaks.com/topic/114203-solved-whats-wrong-with-my-preg_replace/ Share on other sites More sharing options...
auro Posted July 11, 2008 Share Posted July 11, 2008 Hi friend! Try using $keyword = preg_replace('/\+/',' ',$newquery); Or $keyword = str_replace('+',' ',$newquery); This would be faster than preg_replace Quote Link to comment https://forums.phpfreaks.com/topic/114203-solved-whats-wrong-with-my-preg_replace/#findComment-587203 Share on other sites More sharing options...
ballhogjoni Posted July 11, 2008 Author Share Posted July 11, 2008 Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/114203-solved-whats-wrong-with-my-preg_replace/#findComment-587204 Share on other sites More sharing options...
auro Posted July 11, 2008 Share Posted July 11, 2008 You are welcome buddy. If you ever need help, tell me. Quote Link to comment https://forums.phpfreaks.com/topic/114203-solved-whats-wrong-with-my-preg_replace/#findComment-587208 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.