java正则表达式

来源:互联网 发布:tomcat源码有必要 编辑:程序博客网 时间:2024/05/18 22:45

正则表达式是用来验证给定的字符串是否符合某种规则,符合返回true,否则返回false;

使用String中的matches(string reg) 方法

String reg="^[A-Za-z]+$";String str="wadasdasasAd";System.out.println(str.matches(reg));


 

匹配字符串是否纯英文字母的正则;
0 0