public class RegExp { |
private Pattern patt; |
private Matcher matcher; |
/** |
* 通配符匹配: .符号在正则表达式中为通配符含义,匹配所有字符,包括空格、Tab字符甚至换行符 |
* @param regStr 匹配字符串 |
* @param regex 正则表达式 |
* @return |
*/ |
public boolean wildcard (String regStr, String regex) { |
return this .commonRegExp (regStr, regex); |
} |
private boolean commonRegExp (String regStr, String regex) { |
boolean wildcard_Res = false ; |
patt = Pattern.compile (regex); |
matcher = patt.matcher (regStr); |
wildcard_Res = matcher.find(); |
return wildcard_Res; |
} |
} |