Crusader Posted September 26, 2007 Share Posted September 26, 2007 I'm trying to figure out a way to change something like this: [url]http://wordToFind.tld/agawgaw11/agwgag/stuff[/url] into this: [hide][url]http://wordToFind.tld/agawgaw11/agwgag/stuff[/url][/hide] It should search for a specific word, e.g. "wordToFind," in a string but edit the entire string rather than the word. How would I go abouts doing that? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/70776-preg_replace-and-ereg/ Share on other sites More sharing options...
effigy Posted September 26, 2007 Share Posted September 26, 2007 I think the cleanest approach is to use preg_replace_callback to capture the entire "..." string, then check for the text within the callback. Quote Link to comment https://forums.phpfreaks.com/topic/70776-preg_replace-and-ereg/#findComment-355868 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.