Re: [REGEX] Regex ref to '<' character problem (fwd)

From: Date: Thu, 11 Jul 2002 23:31:17 +0000
Subject: Re: [REGEX] Regex ref to '<' character problem (fwd)
Groups: php.general 
Request: Send a blank email to php-general+get-107291@lists.php.net to get a copy of this message
>Hi, > >I try to refer to the '<' character in a regex using preg_replace >function: > >preg_replace("/(http:\/\/.\S+(?<![\<\>]))/", "<a >href=\"$1\" >target='ext'>$1</a>", >"http://test<br>"); PHP needs a \\ just to get a single \, and Regex needs a single \ in front of the <. Thus, you need \\< so that PHP hands \< to Regex and keeps Regex happy. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#107291) next »