regexp

description

syntax

BOOLEAN regexp(VARCHAR str, VARCHAR pattern)

Perform regular matching on the string str, return true if it matches, and return false if it doesn’t match. pattern is a regular expression.

example

  1. // Find all data starting with 'billie' in the k1 field
  2. mysql> select k1 from test where k1 regexp '^billie';
  3. +--------------------+
  4. | k1 |
  5. +--------------------+
  6. | billie eillish |
  7. +--------------------+
  8. // Find all data ending with 'ok' in the k1 field:
  9. mysql> select k1 from test where k1 regexp 'ok$';
  10. +----------+
  11. | k1 |
  12. +----------+
  13. | It's ok |
  14. +----------+

keyword

REGEXP