Topic: 正则表达式?疑惑?着急? |
Print this page |
1.正则表达式?疑惑?着急? | Copy to clipboard |
Posted by: Michell123 Posted on: 2009-12-17 15:50 看到有关有关正则表达式的文章时,自己测试了一个小程序。 不知道为什么不行? 如下: \bcup\b 这个是匹配“cup”的规则 我测试的程序如下: String str="The cup is on the table"; String regEx="\bcup\b"; boolean p1=str.matches((regEx); System.out.println(p1) 为什么打印出来是false. 谢谢! |
2.Re:正则表达式?疑惑?着急? [Re: Michell123] | Copy to clipboard |
Posted by: Michell123 Posted on: 2009-12-17 18:53 我知道哪错了 哈哈 |
3.Re:正则表达式?疑惑?着急? [Re: Michell123] | Copy to clipboard |
Posted by: micsolaris Posted on: 2009-12-18 11:22 呵呵,用matches当然会错啦,因为是全匹配。用find即可。 |
4.Re:正则表达式?疑惑?着急? [Re: Michell123] | Copy to clipboard |
Posted by: Michell123 Posted on: 2009-12-22 17:33 谢谢你 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |