[thelist] RegExp in ASP for validating e-mail and URLs?

Peter Bornhall bornhall at ansbjer.se
Wed Nov 10 05:59:57 CST 2004

Hey, first post this!

Is anyone sitting on good regexp functions (return true if valid, 
otherwise false) for validating e-mail addresses and web URL:s?

Best-case scenario, I'm looking for a function that searches through a 
portion of text and finds valid e-mail addresses and replaces them with 
<a href="mailto:-address here-">-address here-</a>.  Same goes for 
URL:s, where it would be nice to do the same for valid links.  What 
would be an extra addition would be that it would recognize already 
formatted e-mail and link URL:s in the text, and ignore them (or at 
least not break them).  URL:s would be formatted as above, but with the 
"http://" and "ftp://" and such removed from the link text.  I.e. 
"http://www.domain.com" in the text would yield '<a 
href="http://www.domain.com">www.domain.com</a>' in the end...

Anyone who can regexp this?  Personally, I suck at regexps...:-(

- Peter

More information about the thelist mailing list