newstr.replaceAll(regex, replacement);
  
   regex的内容为  中文 && A-Z a-z 1-9 
 
   

解决方案 »

  1.   

    newstr.replaceAll(“中文”, [A-Z][ a-z][ 1-9]);
    这个应该不能匹配到,不知道楼主是不是这个意思?
      

  2.   

    我的意思是将 regex 匹配中文,A-Z, a-z, 1-9  
     将匹配的替换成空格。 
      如果还存在其他字符,将认定为非法字符。
      

  3.   


    String str = " af啊哦额恩as";
    str = str.replaceAll("[\u4e00-\u9fa5]", "z");
    System.out.println(str);
      

  4.   

    刚只匹配了中文
    下面就可以String str = "af啊哦额恩as; ;092.34&&/";
    str = str.replaceAll("[a-zA-Z0-9\u4e00-\u9fa5]|&&", "z");
    System.out.println(str);
      

  5.   

    [\u4e00-\u9fa5]|(&&)|[A-Z]|[a-z]|[1-9]
      

  6.   

    或者:[\u4e00-\u9fa5A-Za-z1-9]|(&&)