Showing posts with label email. Show all posts
Showing posts with label email. Show all posts

Tuesday, April 19, 2011

bash (shell) code to verify email address

I used the regex from here, and modified it to accept lower case letters.

if [[ "$email" =~ "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$" ]]
then
    echo "Email address $email is valid."
else
    echo "Email address $email is invalid."
fi