Chinaunix首页 | 论坛 | 博客
  • 博客访问: 48142
  • 博文数量: 17
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 340
  • 用 户 组: 普通用户
  • 注册时间: 2013-04-10 15:23
文章分类
文章存档

2014年(1)

2013年(16)

我的朋友

分类: Java

2013-06-26 09:28:36


  1. public static boolean CheckForm(String name, String pwd) {
  2.                   String regEx1="[\u4e00-\u9fa5]+";
  3.           String regEx="[a-zA-Z0-9]{4,8}+";//正则表达示:四到八位的数字或字母
  4.           boolean a=name.matches(regEx1);
  5.           boolean b=pwd.matches(regEx);
  6.           System.out.println(a);
  7.           System.out.println(b);
  8.           if(name.matches(regEx1)&&pwd.matches(regEx)) return true;
  9.           else return false;
  10.           }
"[\u4e00-\u9fa5]+"只能是中文。
阅读(1862) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~