Java 实例-拆分字符串2


Java 实例-拆分字符串2

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Matc {
   public static void main(String args[]) {
      Pattern p = Pattern.compile("\\d");
      Matcher mat1 = p.matcher("9652018244");

      while (mat1.find()) {
         System.out.println("\t\t" + mat1.group());
      }
      mat1.reset();
      System.out.println("After done resetting the Matcher, it should be like this");

      while (mat1.find()) {
         System.out.println("\t\t" + mat1.group());
      }
   }
}