java正则

                                      String regex= "[\\d][-][\\d]";

                                       String input= "2-1,3-1,4-2,5-3,6-4,6-5,5-2";

                                     Pattern p = Pattern.compile(regex);

                                     Matcher m = p.matcher(input);

                                     while (m.find()) {

                                               System.out.println("---"+ m.group());

                                     }

你可能感兴趣的:(java,String,regex,input)