mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
替换规则支持js,可以用js判断匹配到的内容决定替换为什么,匹配到的内容变量为result,替换为@js:开头则自动采用js判断替换内容
This commit is contained in:
parent
0280099ec3
commit
ceca1a32d6
@ -29,7 +29,7 @@ suspend fun CharSequence.replace(regex: Regex, replacement: String, timeout: Lon
|
||||
val stringBuffer = StringBuffer()
|
||||
while (matcher.find()) {
|
||||
val bindings = SimpleBindings()
|
||||
bindings["result"] = matcher.group(1)
|
||||
bindings["result"] = matcher.group()
|
||||
val jsResult = AppConst.SCRIPT_ENGINE.eval(js, bindings).toString()
|
||||
matcher.appendReplacement(stringBuffer, jsResult)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user