Regular Expression Problem
Why does [A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ match matt.johnso#[email protected]
but not
matt.johnso#n@exam#ple.com
It allows special characters in the email name, but not in the domain name. I don't get it.
Why does [A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ match matt.johnso#[email protected]
but not
matt.johnso#n@exam#ple.com
It allows special characters in the email name, but not in the domain name. I don't get it.
teammatt3 posted this at 17:27 — 23rd May 2007.
He has: 2,102 posts
Joined: Sep 2003
Sorry, I'm retarded and don't know regular expressions from beans. Here's a better one for email I just found in my book
^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-zA-Z]{2,4}$
JeevesBond posted this at 02:27 — 24th May 2007.
He has: 3,956 posts
Joined: Jun 2002
Cool, thanks for this. I was groaning when I saw 'regular expressions', they're so powerful and yet so evil!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.