note 63199 added to function.preg-replace

From: Date: Wed, 15 Mar 2006 22:50:25 +0000
Subject: note 63199 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-105883@lists.php.net to get a copy of this message
Here is a function that replaces the links (http(s)://, ftp://) with respective html anchor, and also makes all anchors open in a new window. function make_links_blank( $text ) { return preg_replace( array( "/[^\"'=]((http|ftp|https):\/\/[^\s\"']+)/i", "/<a([^>]*)target=\"?[^\"']+\"?/i", "/<a([^>]+)>/i" ), array( "<a href=\"\\1\">\\1</a>", "<a\\1", "<a\\1 target=\"_blank\" >" ), $text ); } ---- Server IP: 193.226.19.70 Probable Submitter: 81.180.201.38 (proxied: 10.10.41.76) ---- X-Spam-Status: No, hits=4.0 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_20_30,HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/note/edit/63199 Del: integrated -- http://master.php.net/note/delete/63199/integrated Del: useless -- http://master.php.net/note/delete/63199/useless Del: bad code -- http://master.php.net/note/delete/63199/bad+code Del: spam -- http://master.php.net/note/delete/63199/spam Del: non-english -- http://master.php.net/note/delete/63199/non-english Del: in docs -- http://master.php.net/note/delete/63199/in+docs Del: other reasons-- http://master.php.net/note/delete/63199 Reject -- http://master.php.net/note/reject/63199 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105883) next »