From 4e22f24a6e9604e78f169bb66241f9ab0334fe96 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Tue, 7 Mar 2023 10:49:17 +0000 Subject: [PATCH 1/2] Add regexp_match docs --- arrow-string/src/regexp.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arrow-string/src/regexp.rs b/arrow-string/src/regexp.rs index 4b1e2dcde228..bd67e688e1fb 100644 --- a/arrow-string/src/regexp.rs +++ b/arrow-string/src/regexp.rs @@ -157,6 +157,26 @@ pub fn regexp_is_match_utf8_scalar( } /// Extract all groups matched by a regular expression for a given String array. +/// +/// Modelled after the Postgres [regexp_match]. +/// +/// Returns a ListArray of [`GenericStringArray`] with each element containing the leftmost-first +/// match of the corresponding index in `regex_array` to string in `array` +/// +/// If there is no match, the list element is NULL. +/// +/// If a match is found, and the pattern contains no capturing parenthesized subexpressions, +/// then the list element is a single-element [`GenericStringArray`] containing the substring +/// matching the whole pattern. +/// +/// If a match is found, and the pattern contains capturing parenthesized subexpressions, then the +/// list element is a [`GenericStringArray`] whose n'th element is the substring matching +/// the n'th capturing parenthesized subexpression of the pattern. +/// +/// The flags parameter is an optional text string containing zero or more single-letter flags +/// that change the function's behavior. +/// +/// [regexp_matches]: https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP pub fn regexp_match( array: &GenericStringArray, regex_array: &GenericStringArray, From ed908a95efc9d7ecbcf34f795262af373a3ae805 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com> Date: Tue, 7 Mar 2023 16:31:23 +0000 Subject: [PATCH 2/2] Update arrow-string/src/regexp.rs Co-authored-by: Liang-Chi Hsieh --- arrow-string/src/regexp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arrow-string/src/regexp.rs b/arrow-string/src/regexp.rs index bd67e688e1fb..f3ba90d8a741 100644 --- a/arrow-string/src/regexp.rs +++ b/arrow-string/src/regexp.rs @@ -176,7 +176,7 @@ pub fn regexp_is_match_utf8_scalar( /// The flags parameter is an optional text string containing zero or more single-letter flags /// that change the function's behavior. /// -/// [regexp_matches]: https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP +/// [regexp_match]: https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP pub fn regexp_match( array: &GenericStringArray, regex_array: &GenericStringArray,