php - validating email address - Reg Expresion


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



Copy this code and paste it in your HTML
  1. <?php
  2. $string = "[email protected]";
  3. if (preg_match(‘/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2}$/’,
  4. $string))
  5. {
  6. echo "example successful.";
  7. }
  8. ?>

URL: http://hmvrulz.wordpress.com/2008/09/22/8-practical-php-regular-expressions/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.