note 15857 deleted from function.preg-replace by sniper

From: Date: Sun, 07 Sep 2003 21:57:49 +0000
Subject: note 15857 deleted from function.preg-replace by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55673@lists.php.net to get a copy of this message
Note Submitter: jdyke@keane.com ---- Some added functionality to the link regexp above. This will grab anything and everything after the .com|.net etc, as well. ie www.server.com/folder/folder/index.php Hope this helps someone. $link = preg_replace("/\b((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.]+)\b/i", "<a href=\"http$3://$4$5$6\" target=\"_blank\">$2$4$5$6</a>", $link);

« previous php.notes (#55673) next »