From 8f93ef44a35545bf24d6a2901bbead4a9a1b6973 Mon Sep 17 00:00:00 2001 From: makejava <1353036300@qq.com> Date: Wed, 6 Jul 2022 15:29:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=A8=E5=B1=80=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E4=B8=8E=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/sjhy/plugin/tool/TemplateUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/sjhy/plugin/tool/TemplateUtils.java b/src/main/java/com/sjhy/plugin/tool/TemplateUtils.java index 9b0702c..6151000 100644 --- a/src/main/java/com/sjhy/plugin/tool/TemplateUtils.java +++ b/src/main/java/com/sjhy/plugin/tool/TemplateUtils.java @@ -35,7 +35,7 @@ public final class TemplateUtils { for (GlobalConfig globalConfig : globalConfigs) { String name = globalConfig.getName(); // 正则被替换字符转义处理 - String value = globalConfig.getValue().replace("$", "\\$"); + String value = globalConfig.getValue().replace("\\", "\\\\").replace("$", "\\$"); // 将不带{}的变量加上{} template = template.replaceAll("\\$!?" + name + "(\\W)", "\\$!{" + name + "}$1");