Result (Expression @NotNull [] params, ExpressionContext context, boolean quick) { if (params.length != 3) { return null; } Result value = params[0].calculateResult(context); if (value == null) { return null; } Result pattern = params[1].calculateResult(context); if (pattern == null) { return null; } Result replacement = params[2].calculateResult(context); if (replacement == null) { return null; } try { return new TextResult(value.toString().replaceAll(pattern.toString(), replacement.toString())); } catch (IndexOutOfBoundsException e) { LOG.warn("Incorrect replacement value specified in Live Template '" + getName() + "' regularExpression() expression"); } catch (PatternSyntaxException e) { LOG.warn("Incorrect regex specified in Live Template '" + getName() + "' regularExpression() expression"); } return null; }