Files
doris/docs/zh-CN/sql-reference/sql-functions/string-functions/regexp/regexp.md
EmmyMiao87 15c5896f41 [Docs] Add like, regexp function documents (#6182)
* [Docs] Add like, regexp function documents

* Reconstruct

* Fix compile error
2021-07-15 13:16:21 +08:00

1.4 KiB

title, language
title language
regexp zh-CN

regexp

description

syntax

'BOOLEAN regexp(VARCHAR str, VARCHAR pattern)'

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

example

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

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

keyword

REGEXP