|
|
package com.tianbo.util.regular;
|
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* @Auther: shenhl
|
|
|
* @Date: 2019/8/29 16:58
|
|
|
*/
|
|
|
public class RegularUtil {
|
|
|
|
|
|
|
|
|
public Matcher matcher(String strtemp, String regular){
|
|
|
|
|
|
//创建Pattern 对象
|
|
|
Pattern r = Pattern.compile(regular);
|
|
|
Matcher matcher = r.matcher(strtemp);
|
|
|
return matcher;
|
|
|
}
|
|
|
|
|
|
// 回执内容正则
|
|
|
public String cusText(String cusText){
|
|
|
|
|
|
String regular = "(\\d{5})";
|
|
|
|
|
|
Matcher matcher = matcher(cusText, regular);
|
|
|
if (matcher.find()){
|
|
|
|
|
|
String group = matcher.group(1);
|
|
|
|
|
|
return group;
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|