REGEXP_EXTRACT

Syntax

REGEXP_EXTRACT( string, pattern )

Description

Returns the substring string that matches the regular expression pattern.

Argument types:

  • stringString
  • patternString

Return type: String

Note

Only constant values are accepted for the arguments (pattern).

Note

See the documentation of the data source to clarify the regular expression syntax. For example, ClickHouse uses the RE2 syntax to compose regular expressions.

Example

REGEXP_EXTRACT("RU 912873", "[A-Z]+\s+(\d+)") = "912873"

Data source support

ClickHouse 21.8, MySQL 8.0.12, Oracle Database 12c (12.1), PostgreSQL 9.3.