New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
正则匹配转义字符相关问题 #603
Comments
'[text!~=".*\\\\(\\\\d*\\\\)"][id="com.miui.securitycenter:id/intercept_warn_allow"]' |
首先你写的规则文件里的转译字符先被 json5 转义一次,然后被 gkd 的 string 类型转义一次,最后传递给 kotlin 的 Regex 所以你要写两次转义,换句话说,如果你想要正则匹配一个原始的 对与 kotlin 来说,要写成 所以对与 gkd 来说,要写成 对与 JavaScript/JSON/JSON5 来说,要写成 matches : '[text~="\\\\\\\\"]' 如果你的规则文件是由 https://github.com/gkd-kit/subscription-template 构建 你可以使用 JavaScript 的原始字符串语法去除一次转义,这样只需要写一次转义 matches : String.raw`[text~="\\\\"]` |
解决了,感谢! |
一些验证
日志文件-无论什么问题不包含日志将会被直接关闭
log.zip
BUG描述(文字/截图/视频)
使用
matches
\notMatches
操作符 且 值 包含转义符时,保存规则将忽略转义符示例规则
保存后规则如下
展开
第33行由
'[text!~=".*\(\d*\)"][id="com.miui.securitycenter:id/intercept_warn_allow"]'
保存为
'[text!~=".*(d*)"][id="com.miui.securitycenter:id/intercept_warn_allow"]'
转义符被忽略
期望行为(文字/截图/视频)
规则第33行保存为
'[text!~=".*\(\d*\)"][id="com.miui.securitycenter:id/intercept_warn_allow"]'
且正常触发实际行为(文字/截图/视频)
规则第33行保存为
'[text!~=".*(d*)"][id="com.miui.securitycenter:id/intercept_warn_allow"]'
The text was updated successfully, but these errors were encountered: