Skip to main content

REGEXP_LIKE

Checks whether the source string matches the pattern and returns 1 for true or 0 for false.

See also:
[SELECT] [ Regex Reference ]


Syntax​

SELECT REGEXP_LIKE(source, pattern) FROM <multipartIdentifier>;

Arguments​

source
A literal string or string column that you want to test for the existence of a pattern defined by a regular expression (pattern).

pattern
The regular expression pattern to search for.

Return Value(s)​

Returns 1 for true (the source matches the pattern) or 0 for false.


Examples​

Determine if a string contains a pattern​

select name,
regexp_like(name, '^vm[0-9]+') as name_starts_with_vm
from azure.compute.virtual_machines
WHERE subscription_id = '273769f6-545f-45b2-8ab8-2f14ec5768dc';

For more information, see https://github.com/google/re2/wiki/Syntax