再提一个问题,怎么写一个email合法性输入检测的正则表达式?

解决方案 »

  1.   

    <script language="javascript">
    function IsEmailInput(obj){
    var str=new String(obj.value);
    regEx=/^([\.\w-]){3,}@([\w-]){3,}(\.([\w]){2,4}){1,2}$/; //验证email格式的正则表达式for javascript
    if (str.search(regEx)==-1)
    {
    alert("Email格式非法,请重新输入!");
    obj.select();
    return false;
    }
    alert("Email格式合法!");
    return true;
    }
    </script><html><head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>验证email格式</title>
    </head><body>
    请输入Email地址:<input type="text" name="inputemail" onkeydown='if (event.keyCode==13) IsEmailInput(this);' size="20">
    </body></html>
      

  2.   

    go towww.regexlib.com/search.aspxenter "email" in the keyword textbox and click on "Search" button
      

  3.   

    http://www.iecn.net/forum/showthread.php?s=&threadid=735&highlight=email
      

  4.   

    \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*VS.NET里的email正则式