return replaced;
}
private Expression regexp(Expression targetExpression, String string, String pattern, String replacement, String flags, ProblemsHandler problemsHandler, FunctionExpression call) {
try {
JsRegExp exp = JsRegExp.compile(pattern, flags);
String replaced = exp.replace(string, replacement);
return buildResult(targetExpression, replaced);
} catch (IllegalArgumentException ex) {
problemsHandler.regexpFunctionError(call, ex.getMessage());
return new FaultyExpression(call.getUnderlyingStructure());
}