I just want to validate :
1.email pattern ------according to gmail
2. password
3. mobile no.
All using REGULAR EXPRESSIONS
any genious in here . pLz help !
I just want to validate :
1.email pattern ------according to gmail
2. password
3. mobile no.
All using REGULAR EXPRESSIONS
any genious in here . pLz help !
[php]$email = $POST[‘email’];
if (!eregi("^([a-zA-Z0-9.-]+)@([a-zA-Z0-9._-]+)\.([a-zA-Z]+)$", $email)) {
return false;
} else {
return true;
}[/php]
why don’t we used preg_match()instead of eregi() ?
Sorry, it was some old code I had.
[php]preg_match(’/^[^@]+@[a-zA-Z0-9._-]+.[a-zA-Z]+$/’, $email)[/php]
So, check for email name, 1 character before @
Check domain name containing all valid characters.
Then check tld for characters after the .
suppose i want upto three characters after “.” Then what should my code be like ?
[php]preg_match(’/^[^@]+@[a-zA-Z0-9._-]+.[a-zA-Z]{1,3}+$/’, $email)[/php]
http://www.regular-expressions.info/email.html has some more examples.