Re: preg_replace question

From: Date: Sat, 16 Aug 2003 13:34:07 +0000
Subject: Re: preg_replace question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159795@lists.php.net to get a copy of this message
Then use a simple strstr to first find out if the string does contain mydomain.com :-) Jean-Christian IMbeault wrote:
I found this nice preg_replace function that replaces all occurrences of an HTML anchor (<a href=...) with a link to another PHP script that log the link and then sends the user on his merry way to the the appropriate page/site: preg_replace( "#<a href=(\"|')http://([^\"']+)(\"|')#ime", '"<a href=\"/exit.php?url=".base64_encode(\'\\2\')."\""', $originalLink ); I'd like to modify this expression so that it does the same thing but *only* if the link is not to a specific page. I.e. I would like to replace all links *unless* the link was to, for example, www.mydomain.com. How can I achieve this with a regexp? I'm not very good at 'negative' regexp ... Thanks, Jean-Christian Imbeault
-- Raditha Dissanayake ------------------------------------------------------------- http://www.radinks.com/sftp/ Lean and mean Secure FTP applet with Graphical User Inteface. just 150 Kilo Bytes

« previous php.general (#159795) next »