Regex在String.Matters()中不起作用我有一小块代码String[] words = {"{apf","hum_","dkoe","12f"};for(String s:words){
if(s.matches("[a-z]"))
{
System.out.println(s);
}}应该打印dkoe但它什么也没印!
3 回答
元芳怎么了
TA贡献1798条经验 获得超7个赞
.matches()
Pattern
Matcher
.find()
Pattern p = Pattern.compile("[a-z]");Matcher m = p.matcher(inputstring);if (m.find()) // match
.matches()
+
[a-z]+
^[a-z]+$
.find()
.
慕雪6442864
TA贡献1812条经验 获得超5个赞
[a-z]+
.*[a-z].*
添加回答
举报
0/150
提交
取消