update 优化 RegexUtils#extractFromString 方法未匹配返回null不返回默认值问题
This commit is contained in:
parent
581b6e03d5
commit
cac0a4cd16
@ -21,7 +21,8 @@ public final class RegexUtils extends ReUtil {
|
||||
*/
|
||||
public static String extractFromString(String input, String regex, String defaultInput) {
|
||||
try {
|
||||
return ReUtil.get(regex, input, 1);
|
||||
String str = ReUtil.get(regex, input, 1);
|
||||
return str == null ? defaultInput : str;
|
||||
} catch (Exception e) {
|
||||
return defaultInput;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user