//while(m.find())
System.out.println(m.group());为什么第一句话注释后 junit就会变红
去掉注释后能有输出

解决方案 »

  1.   

    group() 是取出表达式所匹配到的完整的字符串。find() 是开始寻找。如果没有找的过程,哪有匹配的结果呢?
      

  2.   

         * <p> If the match succeeds then more information can be obtained via the
         * <tt>start</tt>, <tt>end</tt>, and <tt>group</tt> methods.  </p>
         *
         * @return  <tt>true</tt> if, and only if, a subsequence of the input
         *          sequence matches this matcher's pattern
         */
        public boolean find() {
      

  3.   

    find()是查找,group()是查找到的匹配的内容。所以必须先调用find(),在调用group()
      

  4.   

    find()是分组查找, 找到匹配的话,就存入到group()中.找到一个就存一个,可以指定一个,比如:System.out.println(group(2)),即输出找到的每二组的内容. 
      

  5.   

    还在刚学JAVA,不是很清楚啊!!
      

  6.   

    find() 是开始寻找
    group() 是找到匹配匹配的内容