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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to