You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/en/sql-reference/20-sql-functions/06-string-functions/regexp-substr.md
+28
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,34 @@ title: REGEXP_SUBSTR
4
4
5
5
Returns the substring of the string `expr` that matches the regular expression specified by the pattern `pat`, NULL if there is no match. If expr or pat is NULL, the return value is NULL.
6
6
7
+
- REGEXP_SUBSTR does not support extracting capture groups (subpatterns defined by parentheses `()`). It returns the entire matched substring instead of specific captured groups.
8
+
9
+
```sql
10
+
SELECT REGEXP_SUBSTR('abc123', '(\w+)(\d+)');
11
+
-- Returns 'abc123' (the entire match), not 'abc' or '123'.
12
+
13
+
-- Alternative Solution: Use string functions like SUBSTRING and REGEXP_INSTR to manually extract the desired portion of the string:
- REGEXP_SUBSTR does not support the `e` parameter (used in Snowflake to extract capture groups) or the `group_num` parameter for specifying which capture group to return.
-- Error: Databend does not support the 'e' parameter or capture group extraction.
25
+
26
+
-- Alternative Solution: Use string functions like SUBSTRING and LOCATE to manually extract the desired substring, or preprocess the data with external tools (e.g., Python) to extract capture groups before querying.
0 commit comments