subconverter icon indicating copy to clipboard operation
subconverter copied to clipboard

[BUG] 通配符及捕获在rename node下工作有误

Open GOUKI9999 opened this issue 2 years ago • 2 comments

确认版本最新

  • [X] 我已经确认在最新Action编译的版本中复现

检索issue

  • [X] 我已经确认之前没有issue涉及此BUG

subconverter版本

0.7.2

转换过程

自定义clash配置文件yml,和其他订阅合并为新的clash配置文件yml中

转换设置

转换时从订阅获取的文本为

  • {name: 🇭🇰 香港E解锁 , server: server.com, port: 999, type: ss, cipher: aes-128-gcm, password: itspassowrd, plugin: obfs, plugin-opts: {mode: http, host: host.com}, udp: true}

复现步骤

rename=(, password:)(.*?)(, )@$1"$2"$3 理论上应该为所有password字段(前后逗号空格)中的字符串部分增加引号 避免部分简单字符串在clash for windows或其他客户端下出现识别错误

期望结果

  • {name: 🇭🇰 香港E解锁 , server: server.com, port: 999, type: ss, cipher: aes-128-gcm, password: "itspassowrd", plugin: obfs, plugin-opts: {mode: http, host: host.com}, udp: true}

已经使用其他在线的正则测试通过,如符合预期应该如此

实际结果

  • {name: "🇭🇰 香港节点" , server: server.com, port: 999, type: ss, cipher: aes-128-gcm, password: itspassowrd, plugin: obfs, plugin-opts: {mode: http, host: host.com}, udp: true}

引号出现在name字段的字符串,而且不是每行都出现

错误信息

没有错误信息,另,如果将rename规则写入snippets下的yml或文本,并用
rename=!!import:snippets/rename.txt
导入,则无法生效,且日志中显示已经导入成功
2022/08/04 Thu 15:52:47.200700 [6029 548319857392][VERB] Trying to import items from snippets/rename_node.toml
2022/08/04 Thu 15:52:47.314126 [6029 548319857392][VERB] Imported 138 item(s).
但配置内的rename 规则都没有生效

GOUKI9999 avatar Aug 04 '22 08:08 GOUKI9999

rename:重命名节点名称

zhongfly avatar Aug 04 '22 09:08 zhongfly

哦抱歉理解错了,把rename完全理解成replace了

GOUKI9999 avatar Aug 04 '22 09:08 GOUKI9999