d22552000 Posted March 9, 2008 Share Posted March 9, 2008 One of my replacement scripts is not working, here is my php code: $_POST['message'] = preg_replace('/\[font=\"(.+?)\"\](.+?)\[\/font\]/', " <font face=\"$1\">$2</font>", $_POST['message']); $_POST['message'] = preg_replace('/\[color=\"(.+?)\"\](.+?)\[\/color\]/', " <font color=\"$1\">$2</font>", $_POST['message']); When I feed it this: [font="Courier"][color="Yellow"]test[/color][/font] It shows the string as is, and does not evaluate my replacement. Is there something wrong with my pattern? All of my other ones have worked like links, images, and b, i, u, but these two above don't work. I tried it both WITH escaping the " and one WITHOUT escaping the " and still it doesn't process it. I know the script is going through these lines as I tried putting an echo between them, and the echo is shown. Please tell me what is wrong. Quote Link to comment https://forums.phpfreaks.com/topic/95178-preg_replace-not-working/ Share on other sites More sharing options...
d22552000 Posted March 9, 2008 Author Share Posted March 9, 2008 Please? Quote Link to comment https://forums.phpfreaks.com/topic/95178-preg_replace-not-working/#findComment-487527 Share on other sites More sharing options...
d22552000 Posted March 9, 2008 Author Share Posted March 9, 2008 Page3 Bump! Quote Link to comment https://forums.phpfreaks.com/topic/95178-preg_replace-not-working/#findComment-487958 Share on other sites More sharing options...
effigy Posted March 10, 2008 Share Posted March 10, 2008 It works for me. Are you sure about $_POST? Try a print_r($_POST). Quote Link to comment https://forums.phpfreaks.com/topic/95178-preg_replace-not-working/#findComment-488551 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.