- 数字
Pattern pattern = Pattern.compile("^[0-9]+$");
- 字母
Pattern pattern = Pattern.compile("^[a-zA-Z]+$");
- 汉字
Pattern pattern = Pattern.compile("^[\\u4E00-\\u9FA5]+$");
- 汉字字母数字组合
Pattern pattern = Pattern.compile("^[\\u4e00-\\u9fa5a-zA-Z0-9]+$");
网友评论