diff --git a/datafusion/functions/src/regex/regexpcount.rs b/datafusion/functions/src/regex/regexpcount.rs index 29c941125791..a81133713360 100644 --- a/datafusion/functions/src/regex/regexpcount.rs +++ b/datafusion/functions/src/regex/regexpcount.rs @@ -46,7 +46,7 @@ use std::sync::Arc; +---------------------------------------------------------------+ ```"#, standard_argument(name = "str", prefix = "String"), - standard_argument(name = "Regexp", prefix = "Regular"), + standard_argument(name = "regexp", prefix = "Regular"), argument( name = "start", description = "- **start**: Optional start position (the first position is 1) to search for the regular expression. Can be a constant, column, or function." diff --git a/datafusion/functions/src/regex/regexplike.rs b/datafusion/functions/src/regex/regexplike.rs index 35e104d46f64..296ec339a623 100644 --- a/datafusion/functions/src/regex/regexplike.rs +++ b/datafusion/functions/src/regex/regexplike.rs @@ -53,11 +53,7 @@ SELECT regexp_like('aBc', '(b|d)', 'i'); Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs) "#, standard_argument(name = "str", prefix = "String"), - standard_argument(name = "Regexp", prefix = "Regular"), - argument( - name = "start", - description = "- **start**: Optional start position (the first position is 1) to search for the regular expression. Can be a constant, column, or function." - ), + standard_argument(name = "regexp", prefix = "Regular"), argument( name = "flags", description = r#"Optional regular expression flags that control the behavior of the regular expression. The following flags are supported: diff --git a/datafusion/functions/src/regex/regexpmatch.rs b/datafusion/functions/src/regex/regexpmatch.rs index 304b5728ba56..06b9a9d98b47 100644 --- a/datafusion/functions/src/regex/regexpmatch.rs +++ b/datafusion/functions/src/regex/regexpmatch.rs @@ -37,25 +37,26 @@ use std::sync::Arc; description = "Returns the first [regular expression](https://docs.rs/regex/latest/regex/#syntax) matches in a string.", syntax_example = "regexp_match(str, regexp[, flags])", sql_example = r#"```sql -> select regexp_match('Köln', '[a-zA-Z]ö[a-zA-Z]{2}'); -+---------------------------------------------------------+ -| regexp_match(Utf8("Köln"),Utf8("[a-zA-Z]ö[a-zA-Z]{2}")) | -+---------------------------------------------------------+ -| [Köln] | -+---------------------------------------------------------+ -SELECT regexp_match('aBc', '(b|d)', 'i'); -+---------------------------------------------------+ -| regexp_match(Utf8("aBc"),Utf8("(b|d)"),Utf8("i")) | -+---------------------------------------------------+ -| [B] | -+---------------------------------------------------+ + > select regexp_match('Köln', '[a-zA-Z]ö[a-zA-Z]{2}'); + +---------------------------------------------------------+ + | regexp_match(Utf8("Köln"),Utf8("[a-zA-Z]ö[a-zA-Z]{2}")) | + +---------------------------------------------------------+ + | [Köln] | + +---------------------------------------------------------+ + SELECT regexp_match('aBc', '(b|d)', 'i'); + +---------------------------------------------------+ + | regexp_match(Utf8("aBc"),Utf8("(b|d)"),Utf8("i")) | + +---------------------------------------------------+ + | [B] | + +---------------------------------------------------+ ``` Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs) "#, standard_argument(name = "str", prefix = "String"), argument( name = "regexp", - description = "Regular expression to match against. Can be a constant, column, or function." + description = "Regular expression to match against. + Can be a constant, column, or function." ), argument( name = "flags", diff --git a/datafusion/functions/src/regex/regexpreplace.rs b/datafusion/functions/src/regex/regexpreplace.rs index e5a4ddc2ca6a..130c66caeecd 100644 --- a/datafusion/functions/src/regex/regexpreplace.rs +++ b/datafusion/functions/src/regex/regexpreplace.rs @@ -62,19 +62,24 @@ SELECT regexp_replace('aBc', '(b|d)', 'Ab\\1a', 'i'); Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/regexp.rs) "#, standard_argument(name = "str", prefix = "String"), - standard_argument(name = "replacement", prefix = "Replacement string"), argument( name = "regexp", - description = "Regular expression to match against. Can be a constant, column, or function." + description = "Regular expression to match against. + Can be a constant, column, or function." + ), + argument( + name = "replacement", + description = "Replacement string expression to operate on. Can be a constant, column, or function, and any combination of operators." ), argument( name = "flags", description = r#"Optional regular expression flags that control the behavior of the regular expression. The following flags are supported: - - **i**: case-insensitive: letters match both upper and lower case - - **m**: multi-line mode: ^ and $ match begin/end of line - - **s**: allow . to match \n - - **R**: enables CRLF mode: when multi-line mode is enabled, \r\n is used - - **U**: swap the meaning of x* and x*?"# +- **g**: (global) Search globally and don't return after the first match +- **i**: case-insensitive: letters match both upper and lower case +- **m**: multi-line mode: ^ and $ match begin/end of line +- **s**: allow . to match \n +- **R**: enables CRLF mode: when multi-line mode is enabled, \r\n is used +- **U**: swap the meaning of x* and x*?"# ) )] #[derive(Debug)]