commands, ...

This commit is contained in:
Sen 2025-03-25 23:10:40 +01:00
parent 66421e806e
commit 75f91dbf4c
44 changed files with 1035 additions and 631 deletions

View file

@ -13,7 +13,7 @@ public class PatternReplacer {
public PatternReplacer(String variable, boolean matchAll, Function<String, String> function) {
this.variable = variable;
this.matchAll = matchAll;
this.pattern = Pattern.compile("\\$\\((" + variable + (matchAll ? "[^\\)]*" : "") + ")\\)");
this.pattern = Pattern.compile("\\$\\((" + Pattern.quote(variable) + (matchAll ? "[^\\)]*" : "") + ")\\)");
this.function = function;
}
@ -25,7 +25,7 @@ public class PatternReplacer {
String orig = matcher.group(1);
String rep = this.function.apply(orig);
if(rep == null)
throw new ScriptException("Variable '%s' konnte in diesem Kontext nicht ersetzt werden", orig);
throw new RunException("Variable '%s' konnte in diesem Kontext nicht ersetzt werden", orig);
matcher.appendReplacement(sb, rep);
}
matcher.appendTail(sb);