This is an automated email from the ASF dual-hosted git repository. lihaopeng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new d847a93b5a1 [Doc] add REGEXP_EXTRACT_OR_NULL docs (#2437) d847a93b5a1 is described below commit d847a93b5a1e8127a6d9653915e55ca79be67019 Author: zclllyybb <zhaochan...@selectdb.com> AuthorDate: Tue Jun 10 22:50:45 2025 +0800 [Doc] add REGEXP_EXTRACT_OR_NULL docs (#2437) ## Versions - [x] dev - [x] 3.0 - [x] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English --- .../string-functions/regexp-extract-or-null.md | 90 +++++++++++++++++++++ .../string-functions/regexp-extract-or-null.md | 90 +++++++++++++++++++++ .../string-functions/regexp-extract-or-null.md | 94 ++++++++++++++++++++++ .../string-functions/regexp-extract-or-null.md | 94 ++++++++++++++++++++++ .../string-functions/regexp-extract-or-null.md | 94 ++++++++++++++++++++++ .../string-functions/regexp-extract-or-null.md | 94 ++++++++++++++++++++++ 6 files changed, 556 insertions(+) diff --git a/docs/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md b/docs/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md index 103fbbdc247..b32635ece27 100644 --- a/docs/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md +++ b/docs/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md @@ -21,3 +21,93 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + +## Description + +Extract the first substring that matches the target regular expression pattern from the text string, and extract a specific group from it based on the expression group index. + +- Character set matching requires the use of Unicode standard character types. For example, to match Chinese characters, use `\p{Han}`. + +## Syntax + +```sql +REGEXP_EXTRACT_OR_NULL(<str>, <pattern>, <pos>) +``` + +## Parameters + +| Parameter | Description | +| -- | -- | +| `<str>` | String, a text string that needs to be matched with regular expressions. | +| `<pattern>` | String, target pattern. | +| `<pos>` | Integer, the index of the expression group to extract, counting starts from 1. | + +## Return Value + +Return a string type, with the result being the part that matches `<pattern>`. + +- If the input `<pos>` is 0, return the entire first matching substring. +- If the input `<pos>` is invalid (negative or exceeds the number of expression groups), return NULL. +- If the regular expression fails to match, return NULL. + +## Example + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1) | ++---------------------------------------------------------------------------+ +| b | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0) | ++---------------------------------------------------------------------------+ +| bCd | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5) | ++---------------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1) | ++---------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------+ +``` + +```sql +select REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2); +``` + +```text ++---------------------------------------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2) | ++---------------------------------------------------------------------------------------------------------+ +| This is a passage in English 1234567 | ++---------------------------------------------------------------------------------------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md index 103fbbdc247..063952eb21e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md @@ -21,3 +21,93 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + +## 描述 + +提取文本串中最先出现的与目标正则模式匹配的子串,并根据表达式组下标提取其中的特定组。 + +- 字符集匹配需要使用 Unicode 标准字符类型。例如,匹配中文请使用 `\p{Han}`。 + +## 语法 + +```sql +REGEXP_EXTRACT_OR_NULL(<str>, <pattern>, <pos>) +``` + +## 参数 + +| 参数 | 描述 | +| -- | -- | +| `<str>` | 字符串,需要进行正则匹配的文本串。| +| `<pattern>` | 字符串,目标模式。| +| `<pos>` | 整数,要提取的表达式组下标,从 1 开始计数。 | + +## 返回值 + +返回字符串类型,结果为匹配 `<pattern>` 的部分。 + +- 如果输入的 `<pos>` 为 0,返回整个第一次匹配的子文本串。 +- 如果输入的 `<pos>` 不合法(为负数或超出表达式组数量),返回 NULL。 +- 如果正则匹配失败,返回 NULL。 + +## 举例 + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1) | ++---------------------------------------------------------------------------+ +| b | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0) | ++---------------------------------------------------------------------------+ +| bCd | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5) | ++---------------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1) | ++---------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------+ +``` + +```sql +select REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2); +``` + +```text ++---------------------------------------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2) | ++---------------------------------------------------------------------------------------------------------+ +| This is a passage in English 1234567 | ++---------------------------------------------------------------------------------------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md index 103fbbdc247..9847056dbec 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md @@ -21,3 +21,97 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + +## 描述 + +提取文本串中最先出现的与目标正则模式匹配的子串,并根据表达式组下标提取其中的特定组。 + +- 字符集匹配需要使用 Unicode 标准字符类型。例如,匹配中文请使用 `\p{Han}`。 + +:::info +自 Doris 2.1.6 起支持 +::: + +## 语法 + +```sql +REGEXP_EXTRACT_OR_NULL(<str>, <pattern>, <pos>) +``` + +## 参数 + +| 参数 | 描述 | +| -- | -- | +| `<str>` | 字符串,需要进行正则匹配的文本串。| +| `<pattern>` | 字符串,目标模式。| +| `<pos>` | 整数,要提取的表达式组下标,从 1 开始计数。 | + +## 返回值 + +返回字符串类型,结果为匹配 `<pattern>` 的部分。 + +- 如果输入的 `<pos>` 为 0,返回整个第一次匹配的子文本串。 +- 如果输入的 `<pos>` 不合法(为负数或超出表达式组数量),返回 NULL。 +- 如果正则匹配失败,返回 NULL。 + +## 举例 + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1) | ++---------------------------------------------------------------------------+ +| b | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0) | ++---------------------------------------------------------------------------+ +| bCd | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5) | ++---------------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1) | ++---------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------+ +``` + +```sql +select REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2); +``` + +```text ++---------------------------------------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2) | ++---------------------------------------------------------------------------------------------------------+ +| This is a passage in English 1234567 | ++---------------------------------------------------------------------------------------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md index 103fbbdc247..acd70e05a2e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md @@ -21,3 +21,97 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + +## 描述 + +提取文本串中最先出现的与目标正则模式匹配的子串,并根据表达式组下标提取其中的特定组。 + +- 字符集匹配需要使用 Unicode 标准字符类型。例如,匹配中文请使用 `\p{Han}`。 + +:::info +自 Doris 3.0.2 起支持 +::: + +## 语法 + +```sql +REGEXP_EXTRACT_OR_NULL(<str>, <pattern>, <pos>) +``` + +## 参数 + +| 参数 | 描述 | +| -- | -- | +| `<str>` | 字符串,需要进行正则匹配的文本串。| +| `<pattern>` | 字符串,目标模式。| +| `<pos>` | 整数,要提取的表达式组下标,从 1 开始计数。 | + +## 返回值 + +返回字符串类型,结果为匹配 `<pattern>` 的部分。 + +- 如果输入的 `<pos>` 为 0,返回整个第一次匹配的子文本串。 +- 如果输入的 `<pos>` 不合法(为负数或超出表达式组数量),返回 NULL。 +- 如果正则匹配失败,返回 NULL。 + +## 举例 + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1) | ++---------------------------------------------------------------------------+ +| b | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0) | ++---------------------------------------------------------------------------+ +| bCd | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5) | ++---------------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1) | ++---------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------+ +``` + +```sql +select REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2); +``` + +```text ++---------------------------------------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2) | ++---------------------------------------------------------------------------------------------------------+ +| This is a passage in English 1234567 | ++---------------------------------------------------------------------------------------------------------+ +``` diff --git a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md index 103fbbdc247..742f28d9bfc 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md +++ b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md @@ -21,3 +21,97 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + +## Description + +Extract the first substring that matches the target regular expression pattern from the text string, and extract a specific group from it based on the expression group index. + +- Character set matching requires the use of Unicode standard character types. For example, to match Chinese characters, use `\p{Han}`. + +:::info +Support since Apache Doris 2.1.6 +::: + +## Syntax + +```sql +REGEXP_EXTRACT_OR_NULL(<str>, <pattern>, <pos>) +``` + +## Parameters + +| Parameter | Description | +| -- | -- | +| `<str>` | String, a text string that needs to be matched with regular expressions. | +| `<pattern>` | String, target pattern. | +| `<pos>` | Integer, the index of the expression group to extract, counting starts from 1. | + +## Return Value + +Return a string type, with the result being the part that matches `<pattern>`. + +- If the input `<pos>` is 0, return the entire first matching substring. +- If the input `<pos>` is invalid (negative or exceeds the number of expression groups), return NULL. +- If the regular expression fails to match, return NULL. + +## Example + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1) | ++---------------------------------------------------------------------------+ +| b | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0) | ++---------------------------------------------------------------------------+ +| bCd | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5) | ++---------------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1) | ++---------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------+ +``` + +```sql +select REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2); +``` + +```text ++---------------------------------------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2) | ++---------------------------------------------------------------------------------------------------------+ +| This is a passage in English 1234567 | ++---------------------------------------------------------------------------------------------------------+ +``` diff --git a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md index 103fbbdc247..a326d795ddd 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md +++ b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-or-null.md @@ -21,3 +21,97 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + +## Description + +Extract the first substring that matches the target regular expression pattern from the text string, and extract a specific group from it based on the expression group index. + +- Character set matching requires the use of Unicode standard character types. For example, to match Chinese characters, use `\p{Han}`. + +:::info +Support since Apache Doris 3.0.2 +::: + +## Syntax + +```sql +REGEXP_EXTRACT_OR_NULL(<str>, <pattern>, <pos>) +``` + +## Parameters + +| Parameter | Description | +| -- | -- | +| `<str>` | String, a text string that needs to be matched with regular expressions. | +| `<pattern>` | String, target pattern. | +| `<pos>` | Integer, the index of the expression group to extract, counting starts from 1. | + +## Return Value + +Return a string type, with the result being the part that matches `<pattern>`. + +- If the input `<pos>` is 0, return the entire first matching substring. +- If the input `<pos>` is invalid (negative or exceeds the number of expression groups), return NULL. +- If the regular expression fails to match, return NULL. + +## Example + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 1) | ++---------------------------------------------------------------------------+ +| b | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 0) | ++---------------------------------------------------------------------------+ +| bCd | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5); +``` + +```text ++---------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('123AbCdExCx', '([[:lower:]]+)C([[:lower:]]+)', 5) | ++---------------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------------+ +``` + +```sql +SELECT REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1); +``` + +```text ++---------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('AbCdE', '([[:lower:]]+)C([[:upper:]]+)', 1) | ++---------------------------------------------------------------------+ +| NULL | ++---------------------------------------------------------------------+ +``` + +```sql +select REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2); +``` + +```text ++---------------------------------------------------------------------------------------------------------+ +| REGEXP_EXTRACT_OR_NULL('这是一段中文 This is a passage in English 1234567', '(\\p{Han}+)(.+)', 2) | ++---------------------------------------------------------------------------------------------------------+ +| This is a passage in English 1234567 | ++---------------------------------------------------------------------------------------------------------+ +``` --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org