|
@@ -330,6 +330,7 @@ public final class ReportParseUtils {
|
|
|
Pattern pat6 = Pattern.compile("(2\\d{3})年度"); // 2023年度
|
|
|
Pattern pat4 = Pattern.compile("(\\d{4})年(\\d{1,2})月"); // 2023年12月
|
|
|
Pattern pat7 = Pattern.compile("(\\d{4})年_(\\d{1,2})月"); // 2023年_12月
|
|
|
+ Pattern pat8 = Pattern.compile("(\\d{4})(\\d{2})月"); // 202312月
|
|
|
Pattern pat5 = Pattern.compile("(?<!\\d)\\d{4}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])(?!\\d)"); // 20231231
|
|
|
// 创建Matcher对象
|
|
|
Matcher matcher1 = pat1.matcher(string);
|
|
@@ -338,6 +339,7 @@ public final class ReportParseUtils {
|
|
|
Matcher matcher6 = pat6.matcher(string);
|
|
|
Matcher matcher4 = pat4.matcher(string);
|
|
|
Matcher matcher7 = pat7.matcher(string);
|
|
|
+ Matcher matcher8 = pat8.matcher(string);
|
|
|
Matcher matcher5 = pat5.matcher(string);
|
|
|
// 尝试匹配
|
|
|
if (matcher1.find()) {
|
|
@@ -360,10 +362,14 @@ public final class ReportParseUtils {
|
|
|
// 格式4和格式7优先,不满足时才用格式5,都不满足返回null
|
|
|
boolean m4 = matcher4.find();
|
|
|
boolean m7 = matcher7.find();
|
|
|
- if (m4 || m7) {
|
|
|
+ boolean m8 = matcher8.find();
|
|
|
+ if (m4 || m7 || m8) {
|
|
|
String year;
|
|
|
String month;
|
|
|
- if (m4) {
|
|
|
+ if (m8) {
|
|
|
+ year = matcher8.group(1);
|
|
|
+ month = matcher8.group(2);
|
|
|
+ } else if (m4) {
|
|
|
year = matcher4.group(1);
|
|
|
month = matcher4.group(2);
|
|
|
} else {
|
|
@@ -432,10 +438,8 @@ public final class ReportParseUtils {
|
|
|
|
|
|
public static void main(String[] args) throws IOException, ReportParseException {
|
|
|
String s = """
|
|
|
- =?utf-8?b?5Y2D6LGh5Y2T6LaKMuWPt+S4reivgTUwMOaMh+aVsOWinuW8uuengeWLn+ivgQ==?=
|
|
|
- =?utf-8?b?5Yi45oqV6LWE5Z+66YeRLeWNg+ixoeWNk+i2ijLlj7fkuK3or4E1MDDmjIfmlbA=?=
|
|
|
- =?utf-8?b?5aKe5by656eB5Yuf6K+B5Yi45oqV6LWE5Z+66YeRMjAyNeW5tDTmnIjmnIjluqY=?=
|
|
|
- =?utf-8?b?5oql5ZGKLTIwMjUwNTEyLnBkZg==?=
|
|
|
+ =?utf-8?b?5oGS5aSp5Y2D6LGh5LqM5pyf56eB5Yuf6K+B5Yi45oqV6LWE5Z+66YeRLeaBkg==?=
|
|
|
+ 天千象二期私募证券投资基金2025年4月月度报告-20250512.pdf
|
|
|
""";
|
|
|
String s1 = MimeUtility.decodeText(s);
|
|
|
System.out.println(s1);
|