这个很简单啊...去google搜索一下..正则表达式大全...里面什么都有...我的代码验证的一些正则表达式都在网上搜索到的..

解决方案 »

  1.   

    在google里搜到了的人路过,那个比这个要求多,去掉多出来的就行.
    另外正则应该不能做到"不能输入",最多是判断"不能包含"吧.
      

  2.   

    java和js有点小差别,都贴出来了
    另外不知道需不需要区分中英文,所以全都包含了,按实际情况修改 public static void main(String[] args) {
    String req = "[,“” ,\"]";//这里设置非法字符
    String str = "abcdef发的是发的是";
    if(Pattern.compile(req).matcher(str).find()){
    System.out.println("含有非法字符");;
    }else{
    System.out.println("通过");
    }

    str = "abcdef发的是,发的是";
    if(Pattern.compile(req).matcher(str).find()){
    System.out.println("含有非法字符");;
    }else{
    System.out.println("通过");
    }
    }
    <input type="text" id="text1"/>
    <input type="button" value="验证" onclick="mycheck()"/>
    <script>
    function mycheck(){
    var req = /[,“” ,"]/;//这里设置非法字符
    if(req.test(document.getElementById("text1").value)){
    alert("含有非法字符");
    }else{
    alert("通过");
    }
    }
    </script>
      

  3.   

    谢谢8楼  
    我要的正则表达式
    我用的是 seasar2(sa-struts)框架  
    封装好了的 只需要传个正则参数