Hello forums!!
I need a very good validation for "url" and "email" using regular expression.
Following are the criteria for url:
may have http or https @ start
may or may not have www.
may or may not have query string like ?action=a&pack=p
may also support for country level domain

Following are the criteria for email:
info@example.com
info.us@example.com
info@example.net.au
info.us@example.net.au
* may support above formats
Note: regex syntax should be valid for both php and javascript
Any suggestions, comments are warlmy welcome
Thanks in advance to all..

    eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)

      and another

      function isValidAddress( $email, $check = true ){
      if (!ereg("^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z{|}~])*@[a-zA-Z](-?[a-zA-Z0-9])*(\.[a-zA-Z](-?[a-zA-Z0-9])*)+$", $email
      ) ) return false;
      list( $local, $domain ) = split( "@", $email, 2 );
      if ( strlen($local) > 64 || strlen($domain) > 255 ) return false;
      if ( $check && !gethostbynamel( $domain ) ) return false;
      return true;
      }

        thanks for the email validation..I need the url validation too.

          yes well i need new shoes. tried google?

            Write a Reply...