java——Matcher

public static String match(String value ,String complie){
String rs = null;
Pattern regular = Pattern.compile(complie);
Matcher matcher = regular.matcher(value);
if(matcher.find()){
rs = matcher.group(1);
}else{
rs = "没有匹配到想要的东西";
}
return rs;
}

posted @ 2020-07-16 00:14  采蘑菇的小蜜蜂  阅读(320)  评论(0编辑  收藏  举报