text to html parser

Hello,
I am using Applescript to write CGI scripts on my MacOS9 server. I have a web page which allows users to enter text into a textfield (essentially a bulletin board), and would like to use Applescript to turn that text into an html file when someone submits that message. I have the basic part working (puts the appropriate html tags at the top and bottom, finds new paragraphs and inserts

as needed).

However, if someone types in a web address, I would like to encode that so that www.yahoo.com or http://www.yahoo.com turns into
<A HREF="http://www.yahoo.com>www.yahoo.com
so that the link will be active when viewed in a broswer. Similarly, I would like to encode email addresses.

Does anyone have a clever way to do this or to just convert a whole chuck of raw text to html?

Thanks
Ken

This post has been edited.

This is not extensively tested but you can try:

Jon

Wow Thanks Jon. That works just great!