From c06c26a36fc17f0895282c356ec9641589598493 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 23 Sep 2020 08:14:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=84=E5=88=99=E8=A7=A3?= =?UTF-8?q?=E6=9E=90bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/model/analyzeRule/AnalyzeRule.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 d7555c951..55e028134 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 @@ -480,12 +480,18 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { } } + /** + * 拆分\$\d{1,2} + */ private fun splitRegex(ruleStr: String) { var start = 0 var tmp: String val ruleStrArray = ruleStr.split("##") val regexMatcher = regexPattern.matcher(ruleStrArray[0]) while (regexMatcher.find()) { + if (mode != Mode.Js) { + mode = Mode.Regex + } if (regexMatcher.start() > start) { tmp = ruleStr.substring(start, regexMatcher.start()) ruleType.add(0) @@ -652,7 +658,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { private val getPattern = Pattern.compile("@get:\\{([^}]+?)\\}", Pattern.CASE_INSENSITIVE) private val evalPattern = Pattern.compile("@get:\\{[^}]+?\\}|\\{\\{[\\w\\W]*?\\}\\}", Pattern.CASE_INSENSITIVE) - private val regexPattern = Pattern.compile("\\\$\\d{1,2}") + private val regexPattern = Pattern.compile("\\$\\d{1,2}") } }