var str = "允许字母数字汉字及@-()/*等特殊字符出现";
var reg = /^[-\u4e00-\u9fa5@()\/*]+$/;
if(reg.test(str))
   alert("yes");
else
   alert("no");

解决方案 »

  1.   

    to varlj :这些特殊的字符可能出现,也可能不出现。
      

  2.   

    <script>
        function check(obj){
    if (obj.value.match(/^[-\u4e00-\u9fa5@()\/\*]+$/)) {
                alert(obj.value+" is well formed!");
            }
            else {
                alert(obj.value+" is not well formed!");
                obj.value = "";
            }
        }

    </script>
    <input type="text" onblur="check(this)"></input>
      

  3.   

    <script> 
        function check(obj){ 
    if (obj.value.match(/^[-\u4e00-\u9fa5@()\/\*]+$/)) { 
                alert(obj.value+" is well formed!"); 
            } 
            else { 
                alert(obj.value+" is not well formed!"); 
                obj.value = ""; 
            } 
        } </script> 
    <input type="text" onblur="check(this)"> </input>
      

  4.   


    只有出现不该出现的才返回false,只要出现的都属于允许字符就没问题
      

  5.   

    允许字母、数字、汉字及@,-,(),/,*,;等特殊字符出现
    <script> 
        function check(obj){ 
    if (obj.value.match(/^[-\da-zA-Z\u4e00-\u9fa5@()\/\*]+$/)) { 
                alert(obj.value+" is well formed!"); 
            } 
            else { 
                alert(obj.value+" is not well formed!"); 
                obj.value = ""; 
            } 
        } </script> 
    <input type="text" onblur="check(this)" value="允许字母、数字、汉字及@,-,(),/,*,;等特殊字符出现"> </input>
      

  6.   

    楼主,那你就是只排除空格,换行符等特殊字符就可以了
    <script> 
    function check(obj){ 
      if (obj.value.match(/^\S+$/)) { 
          alert(obj.value+" is well formed!"); 
          } 
      else{ 
          alert(obj.value+" is not well formed!"); 
          obj.value = ""; 
          } 

    </script> 
      

  7.   

    最后用的这个:
    /^[0-9a-zA-Z\u4e00-\u9fa5\@\(\)\/\*\.\-\_](\;*[0-9a-zA-Z\u4e00-\u9fa5\@\(\)\/\*\.\-\_])*$/i;
    原本后面是+$/i,可试的进候若输入单 个的字符则通不过,后来改成了这个。