zbparse/flask_app/test_case/test_正则表达式.py
2024-12-05 16:53:11 +08:00

21 lines
609 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_combined = re.compile('^(?:附录(?:一|1)?[:]?|附件(?:一|1)?[:]?|附表(?:一|1)?[:]?|资格性检查|资格审查|符合性审查)', re.MULTILINE)
# 测试字符串
test_strings = [
"附件 4",
"第三部分 商务要求哈哈",
"第六章 哈哈采购",
"第八部分 需求说明",
"第九章 技术要求",
]
for test_string in test_strings:
match = begin_pattern_combined.search(test_string)
if match:
print(f"匹配成功:{test_string}")
else:
print(f"匹配失败:{test_string}")