fix:以文本结构匹配避免正则匹配越界

This commit is contained in:
spiritsoul
2026-01-12 23:31:27 +08:00
parent feac73a427
commit 4c4887f487
2 changed files with 3 additions and 8 deletions

View File

@@ -44,16 +44,10 @@ def modify_speed_go(filepath):
)
content = re.sub(
r'''
\n\s*// 对于三网测速cmcc、cu、ct优先使用 privatespeedtest 进行私有测速
\s*\n
\s*opLower\s*:=\s*strings\.ToLower\(operator\)
[\s\S]*?
\n\s*}\s*
''',
r'^[ \t]*// 对于三网测速cmcc、cu、ct优先使用 privatespeedtest 进行私有测速[\s\S]*?\n\s*\n',
'\n',
content,
flags=re.MULTILINE | re.VERBOSE
flags=re.MULTILINE
)
write_file(filepath, content)

View File

@@ -189,6 +189,7 @@ func CustomSP(platform, operator string, num int, language string) {
return
}
}
var url, parseType string
if strings.ToLower(platform) == "cn" {
if strings.ToLower(operator) == "cmcc" {