DameonMason Posted August 2, 2011 Share Posted August 2, 2011 Im new to PHP 5 and have not coded in about 3 years so now im trying to make a gallery script for for a friend that still have the eregi functions in them. So far so good but the one little error that keeps coming up is the No ending delimiter. My code is as follows if ($this->iswindows) { $AbsoluteFilename = preg_replace('^'.preg_quote(realpath($this->config_document_root)), realpath($this->config_document_root), $AbsoluteFilename); $AbsoluteFilename = str_replace($this->osslash, '/', $AbsoluteFilename); } Obviously i have replaced eregi with preg_replace but now i keep getting the same error. I have tried the blogs and tried their advice but still no luck. Any advice would be much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/243583-warning-preg_replace-functionpreg-replace-no-ending-delimiter-found/ Share on other sites More sharing options...
JAY6390 Posted August 2, 2011 Share Posted August 2, 2011 $AbsoluteFilename = preg_replace('/^'.preg_quote(realpath($this->config_document_root), '/') . '/', realpath($this->config_document_root), $AbsoluteFilename); Quote Link to comment https://forums.phpfreaks.com/topic/243583-warning-preg_replace-functionpreg-replace-no-ending-delimiter-found/#findComment-1250641 Share on other sites More sharing options...
DameonMason Posted August 2, 2011 Author Share Posted August 2, 2011 Wow thanks for the fast reply. You are a LEGEND it has taken me two hours to try and figure out. Quote Link to comment https://forums.phpfreaks.com/topic/243583-warning-preg_replace-functionpreg-replace-no-ending-delimiter-found/#findComment-1250642 Share on other sites More sharing options...
DameonMason Posted August 2, 2011 Author Share Posted August 2, 2011 New to the forum. Is this topic listed as solved now. Is there a spesific reason for the new functions needing the extra syntax changes or is that all part of the move to PHP 5.3? Quote Link to comment https://forums.phpfreaks.com/topic/243583-warning-preg_replace-functionpreg-replace-no-ending-delimiter-found/#findComment-1250643 Share on other sites More sharing options...
JAY6390 Posted August 2, 2011 Share Posted August 2, 2011 It's part of the preg/PCRE syntax for regular expressions, there are delimiters either side of a regex, you can choose pretty much anything so say ~regex-here~ or #regex-here# are both acceptable. You can also add modifiers after the second delimiter, such as "i" to make it case insensitive Take a look here for more information http://www.php.net/manual/en/pcre.pattern.php Quote Link to comment https://forums.phpfreaks.com/topic/243583-warning-preg_replace-functionpreg-replace-no-ending-delimiter-found/#findComment-1250653 Share on other sites More sharing options...
DameonMason Posted August 2, 2011 Author Share Posted August 2, 2011 Thanks man that's really helpful I will be back in the swing of things in no time Quote Link to comment https://forums.phpfreaks.com/topic/243583-warning-preg_replace-functionpreg-replace-no-ending-delimiter-found/#findComment-1250684 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.