详细请看:
http://www.matrix.org.cn/forum_view.asp?forum_id=22&view_id=4762
http://www.matrix.org.cn/forum_view.asp?forum_id=22&view_id=4762
解决方案 »
- 正则([+-]\\d)?的含义
- JList如何默认选中第一个列表
- 对于java.sql.clob的一点疑问!
- 求 thinking in java 课后答案Thinking in Java 3rd Ed. Annotated Solution Guide文档
- 500分寻求一递归算法(急):测试成功后马上给分
- 请教nio阻塞问题
- 有个很着急的问题在jbuilder中如何将程序编译成.exe文件!!!
- 最新 JAVA2核心技术 卷I 的英文版电子书再那里有????
- 不要再对斑竹:hexiaofeng、sharetop 进行人身攻击了,人无完人!希望大家把这个java论坛搞好,才是正经事!祝大家水平越来越高,新春快乐!
- visual cafe哪里找?有多大?
- 非常不可思议的文件重命名(不好意思,因为没分了)
- 布局管理器里面的控件对不齐,有什么办法?
$ The end of a line
\b A word boundary
\BA non-word boundary
\A The beginning of the input
\G The end of the previous match
\Z The end of the input but for the final terminator, if any
\z The end of the input打屁屁,让你不看Doc! 给50分来
引用某本书中的一段解释,讲的是perl中的正则表达式:
The \G assertion is not supported without the /g modifier.
(Currently, without /g, \G behaves just like \A, but that's accidental and may change in the future.)但是java中好像没有/g这个参数,但是jdk doc中确有\G这个参数,那么java中到底如何使用\G呢?
String testStr = "window window"; System.out.println(testStr.matches(pattern));
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(testStr);
while(m.find())
{
System.out.println(m.groupCount() + " " + m.start() + " " + m.end());
} 然后更改String pattern="window" to String pattern="\\Gwindow"; 看结果