Categories:
String Functions (Regular Expressions)

REGEXP

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

Aliases:RLIKE (2nd syntax)

Syntax

<subject> REGEXP <pattern>

Usage Notes

Collation Details

Arguments with collation specifications are currently not supported.

Examples

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

-- Pattern matching with wildcards:
SELECT * FROM rlike_test WHERE city REGEXP 'San* [fF].*';

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