21 lines
558 B
Python
21 lines
558 B
Python
import re
|
||
|
||
# 修改后的正则表达式
|
||
pattern = re.compile(r'^\d+\s*[..]\s*\d+\s*[..]\s*\d+(?![..])')
|
||
|
||
# 测试字符串
|
||
test_strings = [
|
||
'5.1.3 投标文件未按时上传系统的。',
|
||
'5.1.3.1 投标文件未按时上传系统的。',
|
||
'5.1 投标文件未按时上传系统的。',
|
||
'5.1.3 投标成功。',
|
||
]
|
||
|
||
# 测试匹配
|
||
for test_string in test_strings:
|
||
match = pattern.search(test_string)
|
||
if match:
|
||
print(f"匹配成功: {match.group()} -> {test_string}")
|
||
else:
|
||
print(f"未匹配: {test_string}")
|