phorcon3 Posted February 10, 2011 Share Posted February 10, 2011 $str = preg_replace('/('.$word.')/i', '<em>\1</em>', $str); how come this doesn't work when $word = 'http://www.google.com', or any other URL? Link to comment https://forums.phpfreaks.com/topic/227255-preg_replace-url-not-working/ Share on other sites More sharing options...
BlueSkyIS Posted February 10, 2011 Share Posted February 10, 2011 what is in $str? Link to comment https://forums.phpfreaks.com/topic/227255-preg_replace-url-not-working/#findComment-1172286 Share on other sites More sharing options...
BlueSkyIS Posted February 10, 2011 Share Posted February 10, 2011 i get Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' you'll need to escape the slashes in the URL if you want to use it as a match pattern. Link to comment https://forums.phpfreaks.com/topic/227255-preg_replace-url-not-working/#findComment-1172287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.