I've got bits and pieces of text flowing through a program into a database for display on the web only. Some of these bits and pieces may contain web site URLs (almost never beginning with http://
, but www instead) and e-mail addresses. I'd like to be able to identify and wrap up those pieces in <a> tags (i.e. <a href="[URL]"> and <a href="mailto:[EMail]">), much like this question is hyperlinked in certain places.
I could hobble my way through regular expressions (I'm a .NET regex newbie) but I was curious if the experts out there had a couple of regular expressions along with code they already use for this purpose? I found this one while searching around:
but I don't completely understand what it does and I want to know if there's one that's tried and tested and true for both web site URLs and e-mail addresses. Or if someone out there has a better method not using Regular Expressions, I'd love to know what is also.
Thanks for your time.