Github user 1havran commented on a diff in the pull request: https://github.com/apache/metron/pull/912#discussion_r164570247 --- Diff: metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/RegExFunctions.java --- @@ -100,4 +100,39 @@ public Object apply(List<Object> list) { return matcher.group(groupNumber); } } + + @Stellar(name = "REGEXP_REPLACE", + description = "Replace all occurences of the regex pattern within the string by value", + params = { + "string - The input string", + "pattern - The regex pattern to be replaced. Special characters must be escaped (e.g. \\\\d)", + "value - The value to replace the regex pattern" + }, + returns = "The modified input string with replaced values") + public static class RegexpReplace extends BaseStellarFunction { + + @Override + public Object apply(List<Object> list) { + if (list.size() != 3) { + throw new IllegalStateException( + "REGEXP_REPLACE expects three args: [string, pattern, value]" + + " where pattern is a regexp pattern"); + } + String str = (String) list.get(0); + String stringPattern = (String) list.get(1); + String value = (String) list.get(2); + --- End diff -- Thanks for a hint, it is fixed now.
---