danny0405 commented on a change in pull request #1401: [CALCITE-3280] Add 
regexp_replace function (Shuming Li)
URL: https://github.com/apache/calcite/pull/1401#discussion_r317469340
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
 ##########
 @@ -549,6 +550,77 @@ public static boolean posixRegex(String s, String regex, 
Boolean caseSensitive)
     return Pattern.compile(regex, flags).matcher(s).find();
   }
 
+  /** SQL {@code REGEXP_REPLACE} function. */
+  public static String regexpReplace(String s, String regex, String 
replacement) {
+    return regexpReplace(s, regex, replacement, 1, 0, null);
+  }
+
+  /** SQL {@code REGEXP_REPLACE} function. */
+  public static String regexpReplace(String s, String regex, String 
replacement,
+                                     Integer pos) {
+    return regexpReplace(s, regex, replacement, pos, 0, null);
+  }
+
+  /** SQL {@code REGEXP_REPLACE} function. */
+  public static String regexpReplace(String s, String regex, String 
replacement,
+                                     Integer pos, Integer occurrence) {
+    return regexpReplace(s, regex, replacement, pos, occurrence, null);
+  }
+
+  /** SQL {@code REGEXP_REPLACE} function. */
+  public static String regexpReplace(String s, String regex, String 
replacement,
+                                     Integer pos, Integer occurrence, String 
matchType) {
 
 Review comment:
   Fix the indent.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to