详细请看:
http://www.matrix.org.cn/forum_view.asp?forum_id=22&view_id=4762

解决方案 »

  1.   

    Java Doc多全阿!^    The beginning of a line
    $    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分来
      

  2.   

    参看Pattern的Doc ,版本JDK1.4以上
      

  3.   

    我就是看了java doc 中的说明,看不懂才来问得呀,能不能帮忙举几个例子解释一下。
      

  4.   

    \A 和 \Z 的问题解决了,现在就是\G还是搞不明白,测试下来好像没什么效果
    引用某本书中的一段解释,讲的是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呢?
      

  5.   

    String pattern="window";
           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"; 看结果