Re: wrapping anchor tags around a URL
| From: | Ahmed Saad | Date: | Wed, 25 Jan 2006 17:01:53 +0000 |
| Subject: | Re: wrapping anchor tags around a URL | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229251@lists.php.net to get a copy of this message | ||
On 1/25/06, Ahmed Saad <ahmed.lists@gmail.com> wrote:
> On 1/25/06, Ahmed Saad <ahmed.lists@gmail.com> wrote:
> > On 1/23/06, Richard K Miller <richardkmiller@gmail.com> wrote:
> >
> > > function link_the_links($s) {
> > > return preg_replace('@(http://[^\s]+)@sm', '<a
> > > href="$1">$1</a>', $s);
> > > }
try "looking ahead" in the first regex
http://www.regular-expressions.info/lookaround.html
-ahmed