From a6c0acf07feee323c1bc877d3e274cad25303435 Mon Sep 17 00:00:00 2001 From: atbest Date: Fri, 24 May 2019 21:15:42 -0400 Subject: [PATCH] Updated rule --- app/src/main/java/io/legado/app/data/entities/rule/Rule.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/rule/Rule.kt b/app/src/main/java/io/legado/app/data/entities/rule/Rule.kt index 94ebf9b77..c9103c60d 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/Rule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/Rule.kt @@ -10,8 +10,8 @@ data class Rule ( var extra: String? ) { companion object { - val JS_PATTERN = Regex("""\{\{([^}]+?)\}\}""") - val CONST_PATTERN = Regex("""\{(\$\.[^}]+?)\}""") + val JS_PATTERN = Regex("""\{\{([^}]+?)}}""") + val CONST_PATTERN = Regex("""\{(\$\.[^}]+?)}""") fun parse(input: String) = when { input.startsWith("$.") -> parseJSON(input) @@ -69,7 +69,7 @@ data class Rule ( for (line in rawRule.splitNotBlank("\n")) { subRule.clear() val baseRule = BaseRule(type = RuleType.JSON) - baseRule.template = CONST_PATTERN.replace(line) { match -> + baseRule.template = CONST_PATTERN.replace(line.replace("%", "%%")) { match -> subRule.add(match.groupValues[1]) "%s" }