Categories:
String Functions (Regular Expressions)

REGEXP_LIKE

Returns true if the subject matches the pattern. Both expressions must be text expressions.

Aliases:RLIKE (1st syntax)

Syntax

REGEXP_LIKE( <subject> , <pattern> [ , <parameters> ] )

Usage Notes

Collation Details

Arguments with collation specifications are currently not supported.

Examples

-- Example setup
CREATE OR REPLACE TABLE rlike_ex(city varchar(20));
INSERT INTO rlike_ex VALUES ('Sacramento'), ('San Francisco'), ('San Jose'), (null);

-- Case-sensitive pattern matching with wildcards
SELECT * FROM rlike_ex WHERE REGEXP_LIKE(city, 'san.*');

+------+
| CITY |
|------|
+------+

-- Case-insensitive pattern matching with wildcards
SELECT * FROM rlike_ex WHERE REGEXP_LIKE(city, 'san.*', 'i');

+---------------+
| CITY          |
|---------------|
| San Francisco |
| San Jose      |
+---------------+