Repository navigation
Fix Reject URL Regex: 避免 URL-REGEX 中使用逗号 - #114
Merged
Merged
Conversation
Surge splits rule fields on commas, so \d{1,3} truncated these two
regexes to ^http://\d{1 and they never matched. Use \d+ instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013iWLB8qbvZ5YkLEahpL6iy
SukkaW
requested changes
Oct 26, 2026
Per review: \d+ cannot bail out early on hosts like 2026.10.26.1257.example.com. \d\d?\d? keeps each label to 1-3 digits and contains no comma. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013iWLB8qbvZ5YkLEahpL6iy
Contributor
Author
|
Thanks, good point. Updated to Tested with Surge Mac 6.10.0
|
SukkaW
approved these changes
Oct 26, 2026
SukkaW
left a comment
Owner
There was a problem hiding this comment.
LGTM then. In the meantime I will add more validation to detect , in URL-REGEX during ruleset output here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Surge 按逗号分割规则字段。
Source/non_ip/reject-url-regex.conf中这两条 URL-REGEX 的\d{1,3}含有逗号,正则被截断为^http://\d{1:Surge Mac 6.10.0 每次加载
https://ruleset.skk.moe/List/non_ip/reject-url-regex.conf都会记录:因此这两条规则从未生效。
修改
将这两行中的
\d{1,3}改为\d+,不再含逗号,语义基本一致(只是不再限制每段 1–3 位)。验证
在 Surge Mac 6.10.0 上用改写后的规则测试,
http://1.2.3.4/adgateway/x可被正确匹配为 REJECT,且不再出现上述 Invalid regular expression 警告。🤖 Generated with Claude Code
https://claude.ai/code/session_013iWLB8qbvZ5YkLEahpL6iy