Re: wrapping anchor tags around a URL
| From: | Richard K Miller | Date: | Thu, 26 Jan 2006 05:00:20 +0000 |
| Subject: | Re: wrapping anchor tags around a URL | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229292@lists.php.net to get a copy of this message | ||
On Jan 25, 2006, at 10:01 AM, Ahmed Saad wrote:
On 1/25/06, Ahmed Saad <ahmed.lists@gmail.com> wrote:Wow, I was really glad you found that. I had never heard of this before, but it looks like the solution. However, my real life example still isn't working, even after adding what I think was the right look-ahead expression: @(http://\S+)(?!\.)@ -- this still captures everythingOn 1/25/06, Ahmed Saad <ahmed.lists@gmail.com> wrote:try "looking ahead" in the first regex http://www.regular-expressions.info/lookaround.htmlOn 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);}
@(http://\S+?)(?!\.)@ -- this captures too littleAny ideas? In any case, thanks for the article -- that was informative. Richard