How does this look to you guys?
Code: Select all
^[a-zA-Z]+[a-zA-Z0-9_\-.]*@[a-zA-Z0-9]+[a-zA-Z0-9\-.]*\.com|net|info|tv|org|biz|au|eu$Let me know what you think
Moderator: General Moderators
Code: Select all
^[a-zA-Z]+[a-zA-Z0-9_\-.]*@[a-zA-Z0-9]+[a-zA-Z0-9\-.]*\.com|net|info|tv|org|biz|au|eu$I won't comment on the "correctness" of the regex, since I find validating e-mail addresses nonsense: if it is important enough for the user/client to receive e-mail, s/he will give a valid address. If it's solely for the purpose of eliminating typo's the user might make, just let him/her submit the address twice. And (trying) to validate email addresses may lead to valid addresses being rejected by your pattern: which is something a user may find very annoying.take2hikes wrote:I was reading a book earlier and they had a regex that was.. well, flawed.
How does this look to you guys?
I know there is a crazy regex out there that is the 'standard', but I think for most uses this one will work.Code: Select all
^[a-zA-Z]+[a-zA-Z0-9_\-.]*@[a-zA-Z0-9]+[a-zA-Z0-9\-.]*\.com|net|info|tv|org|biz|au|eu$
Let me know what you think
Code: Select all
^[a-zA-Z]+[a-zA-Z0-9_\-.]*@[a-zA-Z0-9]+[a-zA-Z0-9\-.]*\.com
OR
net
OR
info
OR
tv
OR
org
OR
biz
OR
au
OR
eu$Just to be sure, you current regex:take2hikes wrote:Nod, I could always add more domains. It's a toss up between adding more domains via the OR method or just making it certain length accepted.
...
Code: Select all
^[a-zA-Z]+[a-zA-Z0-9_\-.]*@[a-zA-Z0-9]+[a-zA-Z0-9\-.]*\.com|net|info|tv|org|biz|au|eu$Code: Select all
^[a-zA-Z]+[a-zA-Z0-9_\-.]*@[a-zA-Z0-9]+[a-zA-Z0-9\-.]*\.(com|net|info|tv|org|biz|au|eu)$You're welcome.take2hikes wrote:Thanks
prometheuzz wrote:You're welcome.take2hikes wrote:Thanks
Btw, I glanced at your other post, but I am not familiar with PHP design patterns/best practices: I only know a bit of regex.
Good luck with your blog!