d22552000 Posted March 9, 2008 Share Posted March 9, 2008 Well here is my php code, yes it has tabs so it will mess up here but the code is fine, the bottom regexp replacements for the url both work, its the top eight that return errors. Submitting Message... [center] Testing [/center] Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Please tell me what is wrong. echo "Submitting Message...<br />" . $_POST['message']; $_POST['message'] = htmlspecialchars($_POST['message']); ############################################################ $_POST['message'] = preg_replace("\[b\](.+?)\[\/b\]", " <strong>$1</strong>", $_POST['message']); $_POST['message'] = preg_replace("\[i\](.+?)\[\/i\]", " <em>$1</em>", $_POST['message']); $_POST['message'] = preg_replace("\[u\](.+?)\[\/u\]", " <u>$1</u>", $_POST['message']); ############################################################ $_POST['message'] = preg_replace("\[img\](.+?)\[\/img\]", " <img alt=\"$1\" src=\"$1\" />", $_POST['message']); ############################################################ $_POST['message'] = preg_replace("\[left\](.+?)\[\/left\]", " <div align=\"left\">$1</div>", $_POST['message']); $_POST['message'] = preg_replace("\[center\](.+?)\[\/center\]", " <div align=\"center\">$1</div>", $_POST['message']); $_POST['message'] = preg_replace("\[right\](.+?)\[\/right\]", " <div align=\"right\">$1</div>", $_POST['message']); ############################################################ $_POST['message'] = preg_replace("/([a-zA-Z]+:\/\/[a-z0-9\_\.\-]+". "[a-z]{2,6}[a-zA-Z0-9\/\*\-\?\&\%\=\,\.]+)/", " <a href=\"$1\" target=\"_blank\">$1</a>", $_POST['message']); $_POST['message'] = preg_replace("/[^a-z]+[^:\/\/](www\.". "[^\.]+[\w][\.|\/][a-zA-Z0-9\/\*\-\?\&\%\=\,\.]+)/", " <a href=\"http://$1\" target=\"_blank\">$1</a>", $_POST['message']); ############################################################ $_POST['message'] = trim(addslashes($_POST['message'])); Quote Link to comment https://forums.phpfreaks.com/topic/95151-preg_replace-deleminator-must-not-be-alphanumeric-or/ Share on other sites More sharing options...
uniflare Posted March 9, 2008 Share Posted March 9, 2008 this is a pattern error, enclose all of your patterns with "/ -pattern- /" and make sure to escape any / (forward slashes) in your pattern. eg: $_POST['message'] = preg_replace("/\[b\](.+?)\[\/b\]/", " <strong>$1</strong>", $_POST['message']); $_POST['message'] = preg_replace("/\[i\](.+?)\[\/i\]/", " <em>$1</em>", $_POST['message']); $_POST['message'] = preg_replace("/\[u\](.+?)\[\/u\]/", " <u>$1</u>", $_POST['message']); hope this helps, Quote Link to comment https://forums.phpfreaks.com/topic/95151-preg_replace-deleminator-must-not-be-alphanumeric-or/#findComment-487391 Share on other sites More sharing options...
d22552000 Posted March 9, 2008 Author Share Posted March 9, 2008 solved, thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/95151-preg_replace-deleminator-must-not-be-alphanumeric-or/#findComment-487409 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.