java正则表达式

//String regEx2=".+\\\\(.+)$";
  //String str2="c:\\dir1\\dir2\\name.txt";
  String regEx2=" \\{(.+?)\\}";
  String str2="c:\\dir1\\dir2\\test{name.txt11}atese";
  Pattern p2=Pattern.compile(regEx2);
  Matcher m2=p2.matcher(str2);
  boolean rs2=m2.find();
  System.out.println("Count="+m2.groupCount());
  for(int i=1;i<=m2.groupCount();i++){
   
   System.out.println(m2.group(i));
  }

你可能感兴趣的:(java正则表达式)