email Regular Expression
From long time, I've been looking out for a better regular expression for my web application. Every time, I adjust with some freely available expressions and complete the work. But this time, I've decided as not to compromise with what I get for free. And started writing my own expression.
My email validator should justify all the following conditions..
1) it should restrict the user name length between 4 to 50 characters length - {3,50}
2) it should allow dots, underscore, hyphen. But not as starting point - [-.\w]
3) it should allow numerical as well as alphabetic characters of both cases - [0-9a-zA-Z]
4) it should contain one dot after one @
5) all the chars after @ should be at least 2 characters length and may be up to 20 characters consisting of alphanumeric with both cases
After doing all kinds of R&D, concluded as below. Correct me if am mistaken. And extend if you have any further to add
---------------------------------------------
^(([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z]){3,50})*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$
-----------------------------------------------
Comments