Posted on: 09/12/05 08:20am
By: romantaran
Posted on: 09/20/05 04:05am
By: romantaran
$NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)'; $Protocol = '(http|ftp|https):\/\/'; $Domain = '[\w]+(.[\w]+)'; $Subdir = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?'; $Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . '/i'; $Result = preg_replace( $Expr, "<a href=\"$0\" target=\"_blank\">$0</a>", $message ); $NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)'; $NotHTTP = '(?<!:\/\/)'; $Domain = 'www(.[\w]+)'; $Subdir = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?'; $Expr = '/' . $NotAnchor . $NotHTTP . $Domain . $Subdir . '/i'; $message = preg_replace( $Expr, "<a href=\"http://$0\" target=\"_blank\">$0</a>", $Result );