in reply to
replacing clickable web and email addresses
You can try to see what guys in "Perl Text to HTML" Project have done.
Also there is a perl program called txt2html - probably you can be enspired from it's sources.
Results (463 votes),