not regexp

description

syntax

BOOLEAN not regexp(VARCHAR str, VARCHAR pattern)

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

example

  1. // 查找 k1 字段中不以 'billie' 为开头的所有数据
  2. mysql > select k1 from test where k1 not regexp '^billie';
  3. +--------------------+
  4. | k1 |
  5. +--------------------+
  6. | Emmy eillish |
  7. +--------------------+
  8. // 查找 k1 字段中不以 'ok' 为结尾的所有数据:
  9. mysql > select k1 from test where k1 not regexp 'ok$';
  10. +------------+
  11. | k1 |
  12. +------------+
  13. | It's true |
  14. +------------+

keywords

  1. REGEXP, NOT, NOT REGEXP