您的位置:首页 > 其它

HDU1286 找新朋友

2013-06-30 16:49 246 查看
学习过程中随手写的一些测试的代码,记录下来以备日后查看

也希望能给别人些许的帮助

 

System.out.println(".-".matches("[.-]*"));// true
System.out.println(".".matches("[.-]*"));// true
System.out.println("".matches("[.-]*"));// true

System.out.println("".matches("[\\w[.-]]*"));// true
System.out.println("".matches("[\\w[.-]]+"));// false

System.out.println("dfg_33.dd-ff@@".matches("[\\w[.-]]+@{1}"));// false
System.out.println("dfg_33.dd-ff".matches("[\\w[.-]]+@{1}"));// false
System.out.println("df@g_33.dd-ff@".matches("[\\w[.-]]+@{1}"));// false

System.out.println("dfg_33.dd-ff@".matches("[\\w[.-]]+@{1}[\\w[.-]]+"));// false
System.out.println("xxx_yy123-zz.hh@163."
.matches("[\\w[.-]]+@{1}[\\w[-]]+.\\w+"));// false

System.out.println("xxx_yy123zzhh@zh-logistics.com.cn"
.matches("[\\w[.-]]+@{1}[\\w[.-]]+[.]\\w+"));

System.out.println("xxx_yy123zzhh@zh-logistics.com.cn"
.matches("[\\w[.-]]+@[\\w[.-]]+\\.\\w+"));


 

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: