REGEXP_EXTRACT

The REGEXP_EXTRACT function creates dimension values by extracting them from a source dimension using Google RE2 regular expressions.

See the REGEXP_MATCH article for general information on regular expressions in Data Studio.

Sample usage

REGEXP_EXTRACT(Campaign , 'TYPE:(.*)')

Syntax

REGEXP_EXTRACT(X, regular_expression)

 

Parameters

  • X - a field or expression that includes a field.
  • regular_expression - a regular expression that extracts a portion of field_expression.

Returns

The REGEXP_EXTRACT function returns text values.

Example

Extract the top-level directory in a URL:

REGEXP_EXTRACT( URL , '^https://[^/]+/([^/]+)/' )

For example, if the URL field contained this page's address, the function above would return datastudio.

Was this helpful?
How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
Search Help Center
true
102097
false