v.23.2New Feature

Add regexpExtract Function for Compatibility with Spark's REGEXP_EXTRACT

Add new function regexpExtract, like spark function REGEXP_EXTRACT for compatibility. It is similar to the existing function extract. #46469 (李扬).
Added a new function regexpExtract similar to Spark's REGEXP_EXTRACT to the ClickHouse SQL function set for enhanced regex extraction compatibility.

Why it matters

This feature provides compatibility with Spark's REGEXP_EXTRACT function, allowing users to perform regex extraction in a familiar manner. It complements the existing extract function by offering an alternative syntax and behavior for extracting substrings using regular expressions, improving interoperability and user experience for those migrating or integrating with Spark.

How to use it

Use the regexpExtract function in your SQL queries by specifying the source string, the regular expression pattern, and the capture group index you want to extract. For example:

SELECT regexpExtract(column_name, 'pattern', group_index) FROM table_name;