Validate an E-mail or website

check for email pattern

if( !preg_match( "/^(
     (([a-z\-0-9áàäçéèêñóòôöüæøå]+\.)+[a-z]{2,}))$/i", $email ) ) {  
    $msg = 'Email address was not recognized as a valid email pattern';  

get the mx host name

$domain = preg_replace( “/^[\w\W]*@([^@]*)$/i”, “$1”, $email );

Validate an e-mail address

function is_valid_email ($address) {
  return (preg_match(
     '/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+'.   // the user name
     '@'.                                    // the ubiquitous at-sign
     '([-0-9A-Z]+\.)+' .                // host, sub-, and domain names
     '([0-9A-Z]){2,4}$/i',             // top-level domain (TLD)

Validate a Website

function is_valid_web_url($url) {
      //return (preg_match('#^http[s]?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url));
      return (preg_match(
            '.*/i', $url, $m

Leave a Reply

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



See more website here...

  • Advertise Here
  • Advertise Here
  • Advertise Here