跳到主要内容
跳到主要内容

NOT REGEXP

not regexp

description

syntax

BOOLEAN not regexp(VARCHAR str, VARCHAR pattern)

对字符串 str 进行正则匹配,匹配上的则返回 false,没匹配上则返回 true。pattern 为正则表达式。

example

// 查找 k1 字段中不以 'billie' 为开头的所有数据
mysql > select k1 from test where k1 not regexp '^billie';
+--------------------+
| k1 |
+--------------------+
| Emmy eillish |
+--------------------+

// 查找 k1 字段中不以 'ok' 为结尾的所有数据:
mysql > select k1 from test where k1 not regexp 'ok$';
+------------+
| k1 |
+------------+
| It's true |
+------------+

keywords

REGEXP, NOT, NOT REGEXP