url or email
Moderator: General Moderators
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
url or email
I need to find out of a string is either a URL or a E-mail address. I image a regular expression would do it but the only real way I could think would to check for a @ sign and if its found then its a email if not its a URL but I think that should a little sketchy. Any other ideas?
this will match an email address
this will match a url
i think 
Code: Select all
^(ї0-9a-zA-Z]+ї-._+&])*ї0-9a-zA-Z]+@(ї-0-9a-zA-Z]+ї.])+їa-zA-Z]{2,6}$Code: Select all
^(http|https|ftp)\://їa-zA-Z0-9\-\.]+\.їa-zA-Z]{2,3}(:їa-zA-Z0-9]*)?/?(їa-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*ї^\.\,\)\(\s]$