mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-04 03:26:31 +00:00
update 优化 RegexUtils#extractFromString 方法未匹配返回null不返回默认值问题
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user