Page 1 of 1

RegEx creates error

Posted: Mon 29. Mar 2004, 13:58
by Jérôme
I must admit that I am not used to RegEx, but I really can't find the error. These are my lines of code:

Code: Select all

	$replace = product_get_contact_name("bit-ACL-Explorer", $content["products"]);
	$content["all"] = preg_replace('/\{PRODUCTS\}/e', $replace, $content["all"]);
$replace returns a String (I echoed it, and it comes out all right).

The purpose is a replacement tag (I am just testing at the moment).

Posted: Mon 29. Mar 2004, 14:05
by Jérôme
Okidoki, I found it myself.

The error was the "e"-Delimiter at the end of the pattern. It has been there because I had copypasted the code and did not care about the "e". The correct line is:

Code: Select all

$content["all"] = preg_replace('/\{PRODUCTS\}/', $replace, $content["all"]);
I like PHP.net ;).