java 使用正则表达式

String a="123345";
a.matches("\\d");

///
Pattern p=Pattern.compile("ab");
  String u="abcdefsfsaffsabadfewfadfgea";
  Matcher m=p.matcher(u);
  int i=0;
  while(m.find()){
   i++;
  }
  System.out.println(i);

猜你喜欢

转载自dongxylove.iteye.com/blog/2231097