Guernica Posted October 24, 2009 Share Posted October 24, 2009 I have this little function to change phpbb bbcode to regular: // Change phpbb bbcode to regular $search = array( '/\[([a-z]{1})\:^[a-zA-Z0-9_]{1,}$\]/is', '/\[\/([a-z]{1})\:^[a-zA-Z0-9_]{1,}$\]/is'); $replace = array( '[$1]', '[/$1]'); return preg_replace($search,$replace,$str); But it just returns the exact thing that's input. Input: [i:14wft08h][url:14wft08h]http://www.000webhost.com/216468.html[/url:14wft08h][/i:14wft08h] Output: [i:14wft08h][url:14wft08h]http://www.000webhost.com/216468.html[/url:14wft08h][/i:14wft08h] Any help, thanks! Quote Link to comment Share on other sites More sharing options...
.josh Posted October 24, 2009 Share Posted October 24, 2009 remove the ^ and $ Quote Link to comment Share on other sites More sharing options...
Guernica Posted October 24, 2009 Author Share Posted October 24, 2009 Edit: I got it working, nevermind. Thank you very much! Quote Link to comment Share on other sites More sharing options...
.josh Posted October 24, 2009 Share Posted October 24, 2009 well now your problem is that you are just performing the preg_replace on $str and assigning it to $thisBbcode over and over again. since you are not making any changes to $str, you created an infinite loop. Quote Link to comment 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.