RegEx creates error

Post non-phpwcms related topics here - but I don't want to see "hey check this or that other cms". Post if you have a point or worthwhile comment, don't post just to increase you post count!
Post Reply
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

RegEx creates error

Post 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).
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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 ;).
Post Reply