edgar2020 commented on code in PR #16862:
URL: https://github.com/apache/druid/pull/16862#discussion_r1711845042
##########
docs/querying/sql-functions.md:
##########
@@ -1341,28 +1427,90 @@ Returns the rank with gaps for a row within a window.
For example, if two rows t
## REGEXP_EXTRACT
-`REGEXP_EXTRACT(<CHARACTER>, <CHARACTER>, [<INTEGER>])`
+Apply regular expression `pattern` to `expr` and extract the `N`-th capture
group. If `N` is unspecified or zero, returns the first substring that matches
the pattern. Returns `null` if there is no matching pattern.
-**Function type:** [Scalar, string](sql-scalar.md#string-functions)
+* **Syntax:** `REGEXP_EXTRACT(expr, pattern[, N])`
+* **Function type:** Scalar, string
+
+<details><summary>Example</summary>
+
+The following example uses regular expressions to find city names inside the
`OriginCityName` column from the `flight-carriers` datasource by matching what
comes before the comma.
+
+```sql
+SELECT
+ "OriginCityName" AS "original_expr",
+ REGEXP_EXTRACT("OriginCityName", '([^,]+)', 0) AS "pattern_extracted"
+FROM "flight-carriers"
+LIMIT 1
+```
+
+Returns the following:
+
+| `original_expr` | `pattern_extracted` |
Review Comment:
When I think `pattern` I think of the regular expression, `([^,]+)`. I do
think `pattern_extracted` is more appropriate. But maybe we can consider
`extracted` or `pattern_match` or `extract_pattern`
--
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]