From 7b297a45ad41cfcdeb6a5a0eee4d24ac93c9a6b8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 17 Sep 2020 17:08:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=AD=A3=E6=96=87=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/model/analyzeRule/AnalyzeRule.kt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index f9ed9230f..74160e71d 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -343,7 +343,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { } } evalMatcher.appendTail(stringBuffer) - val replaceRegex = stringBuffer.toString() + val replaceRegex = Pattern.quote(stringBuffer.toString()) if (replaceRegex.isNotEmpty()) { vResult = if (rule.replaceFirst) { val pattern = Pattern.compile(replaceRegex) @@ -466,15 +466,8 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { //分离put rule = splitPutRule(rule, putMap) //分离正则表达式 - val index = rule.indexOf("}}") - var rule1 = "" - var rule2 = rule - if (index > 0) { - rule1 = rule.substring(0, index) - rule2 = rule.substring(index) - } - val ruleStrS = rule2.trim { it <= ' ' }.split("##") - rule = rule1 + ruleStrS[0] + val ruleStrS = rule.trim { it <= ' ' }.split("##") + rule = ruleStrS[0] if (ruleStrS.size > 1) { replaceRegex = ruleStrS[1] }