数据仓库服务 GAUSSDB(DWS)-字符处理函数和操作符:REGEXP_LIKE(source_string, pattern [, match_parameter])

时间:2024-05-22 15:13:28

REGEXP_LIKE(source_string, pattern [, match_parameter])

描述:正则表达式的模式匹配函数。

source_string为源字符串,pattern为正则表达式匹配模式。 match_parameter为匹配选项,可取值为:

  • 'i':大小写不敏感。
  • 'c':大小写敏感。
  • 'n':允许正则表达式元字符“.”匹配换行符。
  • 'm':将source_string视为多行。

若忽略match_parameter选项,默认为大小写敏感,“.”不匹配换行符,source_string视为单行。

返回值类型:boolean

示例:

1
2
3
4
5
SELECT regexp_like('ABC', '[A-Z]');
 regexp_like
-------------
 t
(1 row)
1
2
3
4
5
SELECT regexp_like('ABC', '[D-Z]');
 regexp_like
-------------
 f
(1 row)
1
2
3
4
5
SELECT regexp_like('abc', '[A-Z]','i');
 regexp_like
-------------
 t
(1 row)
1
2
3
4
5
SELECT regexp_like('abc', '[A-Z]');
 regexp_like
-------------
 f
(1 row)
support.huaweicloud.com/sqlreference-830-dws/dws_06_0030.html
推荐文章