yiguolei commented on code in PR #2568:
URL: https://github.com/apache/doris-website/pull/2568#discussion_r2179348863
##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-all.md:
##########
@@ -28,25 +61,69 @@ mysql> SELECT regexp_extract_all('AbCdE',
'([[:lower:]]+)C([[:lower:]]+)');
+--------------------------------------------------------------+
| ['b'] |
+--------------------------------------------------------------+
+```
+### 示例 2:字符串中的多个匹配项
Review Comment:
这里不需要是标题,直接是普通的文本就好了。 参考snowflake
https://docs.snowflake.com/en/sql-reference/functions/regexp_count
##########
versioned_docs/version-1.2/sql-manual/sql-functions/string-functions/regexp/regexp-replace.md:
##########
@@ -21,35 +21,93 @@ REGEXP_REPLACE(<str>, <pattern>, <repl>)
| Parameter | Description |
| -- | -- |
-| `<str>` | The column need to do regular matching.|
-| `<pattern>` | Target pattern.|
-| `<repl>` | The string to replace the matched pattern.|
+| `<str>` | This parameter is of Varchar type. It represents the string on
which the regular expression matching will be performed. It can be a literal
string or a column from a table containing string values.|
+| `<pattern>` | This parameter is of Varchar type. It is the regular
expression pattern used to match the string. The pattern can include various
regular expression metacharacters and constructs to define complex matching
rules.|
+| `<repl>` | This parameter is of Varchar type. It is the string that will
replace the parts of the <str> that match the <pattern>. If you want to
reference captured groups in the pattern, you can use backreferences like \1,
\2, etc., where \1 refers to the first captured group, \2 refers to the second
captured group, and so on.|
## Return Value
-Result after doing replacement. It is `Varchar` type.
+The function returns the result string after the replacement operation. The
return value is of Varchar type. If no part of the <str> matches the <pattern>,
the original <str> will be returned.
## Example
+### Test Basic replacement example
+Explain: In this example, all spaces in the string 'a b c' are replaced with
hyphens.
+
```sql
mysql> SELECT regexp_replace('a b c', ' ', '-');
+-----------------------------------+
| regexp_replace('a b c', ' ', '-') |
+-----------------------------------+
| a-b-c |
+-----------------------------------+
+```
+### Test Using captured groups
Review Comment:
不要写标题,直接把这个 标题行和 Explain 那行合并到一行里就可以了。 你看oracle
https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/REGEXP_SUBSTR.html
也不会加这种标题,一般都是用普通的文本。
##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract.md:
##########
@@ -40,17 +64,71 @@ mysql> SELECT regexp_extract('AbCdE',
'([[:lower:]]+)C([[:lower:]]+)', 1);
+-------------------------------------------------------------+
| b |
+-------------------------------------------------------------+
+```
+### 示例 2:提取第二个匹配部分
Review Comment:
这种的,把两行直接 merge 成一行。
另外,不要加 “解释” 这种词。
##########
docs/sql-manual/sql-functions/scalar-functions/string-functions/regexp-extract-all.md:
##########
@@ -21,41 +21,88 @@ REGEXP_EXTRACT_ALL(<str>, <pattern>)
| Parameter | Description |
| -- | -- |
-| `<str>` | The column need to do regular matching.|
-| `<pattern>` | Target pattern.|
+| `<str>` | This parameter is of type String. It represents the input string
on which the regular expression matching will be performed. This can be a
literal string value or a reference to a column in a table that contains string
data.|
+| `<pattern>` | This parameter is also of type String. It specifies the
regular expression pattern that will be used to match against the input string
<str>. The pattern can include various regular expression constructs such as
character classes, quantifiers, and sub - patterns.|
## Return value
-Value after extraction. It is `String` type.
+The function returns an array of strings that represent the parts of the input
string that match the first sub - pattern of the specified regular expression.
The return type is an array of String values. If no matches are found, or if
the pattern has no sub - patterns, an empty array is returned.
## Example
+### Example 1: Basic matching of lowercase letters around 'C'.
+Explain: In this example, the pattern ([[:lower:]]+)C([[:lower:]]+) matches
the part of the string where one or more lowercase letters are followed by 'C'
and then one or more lowercase letters. The first sub - pattern ([[:lower:]]+)
before 'C' matches 'b', so the result is ['b'].
+
```sql
mysql> SELECT regexp_extract_all('AbCdE', '([[:lower:]]+)C([[:lower:]]+)');
+--------------------------------------------------------------+
| regexp_extract_all('AbCdE', '([[:lower:]]+)C([[:lower:]]+)') |
+--------------------------------------------------------------+
| ['b'] |
+--------------------------------------------------------------+
+```
+
+### Example 2: Multiple matches in a string
Review Comment:
比如这个,你可以改成。
Multiple matches in a string. The first match has the first sub - pattern
matching 'b', and the second match has the first sub - pattern matching 'f'. So
the result is ['b', 'f'].
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]