Pages

Thursday, March 26, 2009

Regular Expression for Email in Perl

The following is a regular expression whic can be used to check a valid email.

^[a-z]+\d*[_.]*[a-z]*@[a-z]+\.(com|org|net|in|co\.in)$

This will check the following
1) Email should start with a letter.
2) There can be any digit or _ or . in between the username.
3) Should contain @ symbol after username.
4) After @ symbol it should have domain name
5) The allowed extensions are com,net,org,in,co.in

suggessions are welcome

No comments: