2024-10-21 20:46:48 +08:00

25 lines
717 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import re
begin_pattern = re.compile(r'第[一二三四五六七八九十]+章\s*(招标公告|投标须知.*)|(^|\n)第一卷|招标编号:|招标编号:')
# 测试用例
test_cases = [
"第一章 招标公告",
"\n第一章 招标公告", # 在第二行
"第二章 投标须知",
"第三章 投标须知要求",
"第一卷 投标文件格式",
"招标编号: ABC123",
"招标编号DEF456",
"第三章 项目概述",
"第四章 评标办法"
]
# 测试匹配
for i, case in enumerate(test_cases, 1):
match = begin_pattern.search(case)
if match:
print(f"Test case {i}: Matched - '{case}'")
else:
print(f"Test case {i}: Not matched - '{case}'")