Jump to content

Warning: preg_replace() [function.preg-replace]: No ending delimiter '^' found


Recommended Posts

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.

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.