regex backreference help needed (PCRE)

From: Date: Thu, 01 Jun 2000 17:53:47 +0000
Subject: regex backreference help needed (PCRE)
Groups: php.general 
Request: Send a blank email to php-general+get-844@lists.php.net to get a copy of this message
Hi, I'm trying to use backreferences in the PCRE stuff, but this code: <? $text = "Turn <B>bold</B> to a link"; $newtext = preg_replace( "/<B>(.*)?<\/B>/e", "<A href=\\1><B>\\1</B></A>", $text ); echo "\$text = $text<BR>"; echo "\$newtext = $newtext<BR>"; ?> ... produces this odd error: Parse error: parse error in /usr/local/apache/htdocs/megsoc2/test/boldlinks1.php on line 0 and all the regex has done is inserted a space instead of the backreference. Any ideas? thanks, - Kev

« previous php.general (#844) next »