MCPcopy Create free account
hub / github.com/Moli-X/Resources / ReplaceReg

Function ReplaceReg

Script/Parser.js:1411–1424  ·  view source on GitHub ↗
(cnt, para)

Source from the content-addressed store, hash-verified

1409// 正则替换 filter/rewrite 的部分
1410// 用途:如 tiktok 换区: JP -> KR ,如淘宝比价脚本 -> lite 横幅通知版本
1411function ReplaceReg(cnt, para) {
1412 var cnt0 = cnt//.join("\n")
1413 //$notify("0","",cnt0)
1414 var pp = para.replace(/\\\@/g,"atsymbol").replace(/\\\+/g,"plussymbol").split("+");
1415 for (var i = 0; i < pp.length; i++) {
1416 var p1 = decodeURIComponent(pp[i].split("@")[0]).replace(/atsymbol/g,"\@").replace(/plussymbol/g,"\\\+").replace(/\,/g,",");
1417 var p2 = decodeURIComponent(pp[i].split("@")[1]).replace(/atsymbol/g,"@").replace(/plussymbol/g,"+").replace(/\,/g,",");
1418 p1 = new RegExp(p1, "gmi");
1419 cnt0 = cnt0.map(item => item.replace(p1, p2));
1420 //$notify(p1,p2,cnt0)
1421 }
1422 //$notify("1","",cnt0)
1423 return cnt0//.split("\n")
1424}
1425
1426//混合订阅类型,用于未整体进行 base64 encode 以及已经 decode 后的类型
1427function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {

Callers 1

ResourceParseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected