Re: preg_replace

From: Date: Fri, 01 Nov 2013 15:22:29 +0000
Subject: Re: preg_replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-322400@lists.php.net to get a copy of this message
If you only want to replace the string 'TAG000000-', you can just use 'str_replace()' (no need to use regular expression). http://php.net/manual/en/function.str-replace.php If you DO want to use regular expression (with preg_replace()), then you need to understand regular expressions first: http://www.regular-expressions.info/ Le 01/11/2013 15:06, leam hall a écrit :
Despite my best efforts to ignore preg_replace, it seems the best answer for the current problem. That is, if I can get it to work... Problem code:
         $remove = "TAG000000-";
         $replaceWith = "";
         $newTitle = preg_replace($remove, $replaceWith, $title);
This, as well as using the $remove and $replaceWith as themselves and not variables, gives: PHP Warning: preg_replace(): Delimiter must not be alphanumeric or backslash Thoughts? Leam


« previous php.general (#322400) next »