Click to See Complete Forum and Search --> : Regular expressions


YoN
09-16-2003, 08:16 PM
Hi,

Does anyone have a nice regular expression for e-mail address and other for url?

any help would be very appreciated :)

Jona
09-16-2003, 10:19 PM
You mean for validating an email address? Also, what exactly do you mean "for URL"? (I know what a URL is, but I am wondering what you want to do with it, as well. Validate?)

[J]ona

pyro
09-16-2003, 10:56 PM
If you mean validating, Jeff Mott has created an excellent regexp based on the RFC822 standard at http://forums.webdeveloper.com/showthread.php?s=&threadid=9604#post49397 and something like this regexp can be used to validate URLs...

/^(http(s?):\/\/|ftp:\/\/{1})((\w+\\.)+)\w{2,}(\/?)$/i

YoN
09-17-2003, 09:03 PM
Yapp, that's what i meant; email and url address validation :)

Thanks Pyro.. I had one regex for mail address validation i made myself; although i knew it was poor i didn't knew it was that far from a real one. :p i'll try it ;)

TIA

pyro
09-17-2003, 09:05 PM
I posted the code for a basic url validation scheme above...

YoN
09-17-2003, 09:15 PM
heheh yupp yupp my mistake
;)