PHP (RegEx) Email Address Validation

/ Published in: PHP
Save to your folder(s)

A simple method of validating an email address using PHP and regular expressions

Copy this code and paste it in your HTML
  1. $string = "[email protected]";
  2. '/^[^\W][a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*\@[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*\.[a-zA-Z]{2,4}$/',
  3. $string)) {
  4. echo "example 3 successful.";
  5. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.