【发布时间】:2016-07-26 17:50:37
【问题描述】:
文档说 regexp_instr() 和 ~ 是区分大小写的 Posix 评估函数和运算符。 是否有不区分大小写的 Posix 语法,或基于 PCRE 的函数或运算符的插件
在 Redshift 查询中尝试的 PCRE 示例由于 POSIX'ness 而无法正常工作。
select
A.target
, B.pattern
, regexp_instr(A.target, B.pattern) as rx_instr_position
, A.target ~ B.pattern as tilde_operator
, regexp_instr(A.target
, 'm/'||B.pattern||'/i') as rx_instr_position_icase
from
( select 'AbCdEfffghi' as target
union select 'Chocolate' as target
union select 'Cocoa Latte' as target
union select 'coca puffs, delivered late' as target
) A
,
( select 'choc.*late' as pattern
union select 'coca.*late' as pattern
union select 'choc\w+late' as pattern
union select 'choc\\w+late' as pattern
) B
【问题讨论】:
-
您想在 POSIX 正则表达式风格中使用什么模式?
标签: regex posix amazon-redshift pcre