REGEXP_MATCH function equivalent in Google BigQuery SQL

You will get, Error: Function not found: REGEXP_MATCH. The alternative / equivalent to REGEXP_MATCH is REGEXP_CONTAINS in Bigquery.

Syntax:

REGEXP_CONTAINS(value, regexp)

Returns TRUE if value is a partial match for the regular expression, regexp

Example:

SELECT
email,
REGEXP_CONTAINS(email, r"@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+") AS is_valid
FROM
(SELECT
["foo@ example.com", "bar@ example.org", "www.example.net"]
AS addresses),
UNNEST(addresses) AS email;
+-----------------+----------+
| email | is_valid |
+-----------------+----------+
| foo@ example.com | true |
| bar@ example.org | true |
| www.example.net | false |
+-----------------+----------+

nVector

posted on 12 May 20

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds