请教一个正则表达式:只能输入中文英文不能输入数字

解决方案 »

  1.   


    if("中文abc+-*/".matches("\\D*")){
    System.out.println("没有数字");
    }
    else{
    System.out.println("有数字");
    }
      

  2.   


    String s = new String("百dds7f");
    boolean b = s.matches("^[\u0391-\uFFE5A-Za-z]+$");
    System.out.println(b);
      

  3.   

    ^[A-Za-z]+$  //匹配由26个英文字母组成的字符串 aspxuexiB
    ^[A-Z]+$  //匹配由26个英文字母的大写组成的字符串ABC
    ^[a-z]+$  //匹配由26个英文字母的小写组成的字符串 aaaaa
      

  4.   

    标点都可以匹配吧?包括全角半角? Pattern p = Pattern.compile("[\u0391-\uFFE5Aa-zA-Z\\pP]*");
    Matcher m = p.matcher("aafef:,.。我我我我我");
    System.out.println(m.matches());