parser v10.1.17发布到maven central 允许开发者依赖

1. 添加自定义解析器扩展和相关示例
2. 优化pom结构
This commit is contained in:
q
2025-10-17 15:50:45 +08:00
parent c16bde6bb8
commit 5e09b8e92a
33 changed files with 2421 additions and 93 deletions
@@ -4,6 +4,8 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CommonUtils {
@@ -44,4 +46,29 @@ public class CommonUtils {
return map;
}
/**
* 提取第一个匹配的非空捕捉组
* @param matcher 已创建的 Matcher
* @return 第一个非空 group,或 "" 如果没有
*/
public static String firstNonEmptyGroup(Matcher matcher) {
if (!matcher.find()) {
return "";
}
for (int i = 1; i <= matcher.groupCount(); i++) {
String g = matcher.group(i);
if (g != null && !g.trim().isEmpty()) {
return g.trim();
}
}
return "";
}
/**
* 直接传 html 和 regex,返回第一个非空捕捉组
*/
public static String extract(String input, Pattern pattern) {
Matcher matcher = pattern.matcher(input);
return firstNonEmptyGroup(matcher);
}
}
@@ -17,7 +17,7 @@ import static cn.qaiu.util.AESUtils.encrypt;
* 执行Js脚本
*
* @author <a href="https://qaiu.top">QAIU</a>
* @date 2023/7/29 17:35
* Create at 2023/7/29 17:35
*/
public class JsExecUtils {
private static final Invocable inv;
@@ -2,7 +2,7 @@ package cn.qaiu.util;
/**
* @author <a href="https://qaiu.top">QAIU</a>
* @date 2023/7/16 1:53
* Create at 2023/7/16 1:53
*/
public class PanExceptionUtils {
@@ -4,7 +4,7 @@ import java.security.SecureRandom;
/**
* @author <a href="https://qaiu.top">QAIU</a>
* @date 2024/5/13 4:10
* Create at 2024/5/13 4:10
*/
public class UUIDUtil {