commit
b3fd5a9075
|
@ -2112,12 +2112,14 @@ public class FHIRPathEngine {
|
||||||
|
|
||||||
private List<Base> funcReplaceMatches(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException {
|
private List<Base> funcReplaceMatches(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException {
|
||||||
List<Base> result = new ArrayList<Base>();
|
List<Base> result = new ArrayList<Base>();
|
||||||
String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
|
String regex = convertToString(execute(context, focus, exp.getParameters().get(0), true));
|
||||||
|
String repl = convertToString(execute(context, focus, exp.getParameters().get(1), true));
|
||||||
|
|
||||||
if (focus.size() == 1 && !Utilities.noString(sw))
|
if (focus.size() == 1 && !Utilities.noString(regex)) {
|
||||||
result.add(new BooleanType(convertToString(focus.get(0)).contains(sw)));
|
result.add(new StringType(convertToString(focus.get(0)).replaceAll(regex, repl)));
|
||||||
else
|
} else {
|
||||||
result.add(new BooleanType(false));
|
result.add(new StringType(convertToString(focus.get(0))));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2244,12 +2244,14 @@ public class FHIRPathEngine {
|
||||||
|
|
||||||
private List<Base> funcReplaceMatches(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws FHIRException {
|
private List<Base> funcReplaceMatches(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws FHIRException {
|
||||||
List<Base> result = new ArrayList<Base>();
|
List<Base> result = new ArrayList<Base>();
|
||||||
String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
|
String regex = convertToString(execute(context, focus, exp.getParameters().get(0), true));
|
||||||
|
String repl = convertToString(execute(context, focus, exp.getParameters().get(1), true));
|
||||||
|
|
||||||
if (focus.size() == 1 && !Utilities.noString(sw))
|
if (focus.size() == 1 && !Utilities.noString(regex)) {
|
||||||
result.add(new BooleanType(convertToString(focus.get(0)).contains(sw)));
|
result.add(new StringType(convertToString(focus.get(0)).replaceAll(regex, repl)));
|
||||||
else
|
} else {
|
||||||
result.add(new BooleanType(false));
|
result.add(new StringType(convertToString(focus.get(0))));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue