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" }