Re: preg question

From: Date: Thu, 12 Apr 2001 22:50:11 +0000
Subject: Re: preg question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48370@lists.php.net to get a copy of this message
"Michael Geier" <mgeier@cdmsports.com> wrote: > What I need to find is all the urls in the document and make hrefs out of > them. > > ie: > http://www.mysite.com becomes &lt;a > > href="http://www.mysite.com"&gt;http://www.mysite.com&lt;/a&gt; > > any ideas? TIA! I use this code in my PHPost project: $s = ereg_replace("([[:alpha:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "<a href=\"\\1://\\2\\3\" target=\"_blank\">\\0</a>", $s ); Mark

« previous php.general (#48370) next »