Add links to a text with URLs

http://www.peterbe.com/plog/add-hrefs/test.html

3rd of November 2004

I've now written a little something that is able to convert a piece of text and make URLs into hyperlinks. Here's an example:

 Go to www.abc.com
 and foo@bar.com

this becomes:

 Go to <a href="http://www.abc.com">www.abc.com</a>
 and <a href="mailto:foo@bar.com">foo@bar.com</a>

Links in email program screenshot

Most of you have probably seen this in the way emails are displayed within their email program. See this screenshot:

Now, what my little program does is that it attempts to accomplish the same effect. The script is written in Python and will be available for download here soon. First I just want you people to help me find any bugs first.

Please try with your text



Comment

Show all 3 comments
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.