Pattern pattern = Pattern.compile("4$");
Matcher isMathe = pattern.matcher("1234564");
return isMathe.matches();为什么返回的是false???
Matcher isMathe = pattern.matcher("1234564");
return isMathe.matches();为什么返回的是false???
解决方案 »
- ireport 分组问题
- Eclipse
- tomcat6.0安装版已经配置完成,输入http://localhost:80/my/index.html出现HTTP status 404错误,怎么解决?
- jfeeChart生成图在jsp页面上,怎么把它导出到excel中
- spring中的bean节点了解
- 关于struts 2 中datetimepicker startDate到使用问题
- 关于一个数据库表设计的问题,请大家帮忙看哈一下,谢谢
- 一直很困action中返回type为json类型的数据
- eclipse jboss 配置错误,HELP
- 帮忙就给分,急事!!!!!
- spring 我的一个类继承了MethodBeforeAdvice为什么eclipse老提示Configure build path呢?
- spring controller打包jar
1234554和你的4$明显不匹配
Matcher isMathe = pattern.matcher("1234564");
return isMathe.matches();
这样就true了
1234564整个是一个单词,所以4$匹配不上
Pattern pattern = Pattern.compile("4$");
Matcher isMathe = pattern.matcher("1234564");
System.out.println(isMathe.find());
用find就行,不知道这2个函数有啥区别
Pattern pattern = Pattern.compile("[\\d]+4$");
Matcher isMathe = pattern.matcher("13110420125");这样就能匹配
String str = "erei5394";
第一种还来的快简单
System.out.println("4".equals(str.substring(str.length()-1, str.length())));
第二种就是用find
Pattern pattern = Pattern.compile("4$");
Matcher isMathe = pattern.matcher(str); System.out.println(isMathe.find());
此正则在EmEditor中测试能过