in ,

Validate Email Address With Regular Expression in PHP


In creating an registration form or feedback form, user has to enter email address on the form which needs to validate manually. If we will not validate for a proper email address, your web form will be the victim of spam registrations. This is a good practice for making the application secure and your data from spams. For checking an email address to be valid or not, you have to check it with the help of a regular expression. It checks whether the email address follows a valid rule or not.

An email id of the form [email protected] is a valid email address.

See the code below.

This was the sample code that will validate the email address and then print whether the email address is valid or not. You can use it a function to return true or false after checking for a valid email address.

PHP also has a built in email validation function. You can also use that function. See the code below:




Written by Deepanker

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.

Leave a Reply

Your email address will not be published. Required fields are marked *


How to Write Text on a Image Using PHP

Check Username Availability Using PHP And Jquery