regexp
Description
Syntax:
BOOLEAN regexp(VARCHAR str, VARCHAR pattern)
This function performs regular matching on the string str
. If the string matches the condition, it will return true; if it doesn't, it will return false. pattern
is a regular expression.
Example
// Find all data starting with 'billie' in the k1 field
mysql> select k1 from test where k1 regexp '^billie';
+--------------------+
| k1 |
+--------------------+
| billie eillish |
+--------------------+
// Find all data ending with 'ok' in the k1 field:
mysql> select k1 from test where k1 regexp 'ok$';
+----------+
| k1 |
+----------+
| It's ok |
+----------+
Keywords
REGEXP