[ 
https://issues.apache.org/jira/browse/FLINK-9991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16613222#comment-16613222
 ] 

ASF GitHub Bot commented on FLINK-9991:
---------------------------------------

yanghua commented on a change in pull request #6450: [FLINK-9991] [table] Add 
regexp_replace supported in TableAPI and SQL
URL: https://github.com/apache/flink/pull/6450#discussion_r217310362
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala
 ##########
 @@ -205,6 +206,26 @@ object ScalarFunctions {
     new String(data)
   }
 
+
+  /**
+    * Returns a string resulting from replacing all substrings
+    * that match the regular expression with replacement.
+    */
+  def regexp_replace(str: String, regex: String, replacement: String): String 
= {
 
 Review comment:
   @xccui Thank you for your suggestion, I replaced it with String#replace, my 
original code and the current code work fine, but I think we can't call 
`Matcher.quoteReplacement()` on the regular expression string, it will cause 
Some test cases are not normal, such as `r$`, we will not get `fooba`

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


> Add regexp_replace supported in TableAPI and SQL
> ------------------------------------------------
>
>                 Key: FLINK-9991
>                 URL: https://issues.apache.org/jira/browse/FLINK-9991
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: vinoyang
>            Assignee: vinoyang
>            Priority: Minor
>              Labels: pull-request-available
>
> regexp_replace is a very userful function to process String. 
>  For example :
> {code:java}
> regexp_replace("foobar", "oo|ar", "") //returns 'fb.'
> {code}
> It is supported as a UDF in Hive, more details please see[1].
> [1]: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to