Regex 蜂巢状匹配词边界

Regex 蜂巢状匹配词边界,regex,hive,hiveql,word-boundary,rlike,Regex,Hive,Hiveql,Word Boundary,Rlike,我不熟悉Hive正则表达式匹配,正在努力找到匹配单词边界的正确模式: haystack RLIKE concat('(?i)\b', 'needle', '\b') 不返回任何内容 以DB为单位的示例值: haystack --------- needless to say this is a needle so many (needle) these are needles 当我使用类似干草堆的贝壳(“(?I)”,“针”)时,它会返回我所有的行,但我实际上是在寻找这是一个针,在蜂巢中使用两

我不熟悉Hive正则表达式匹配,正在努力找到匹配单词边界的正确模式:

haystack RLIKE concat('(?i)\b', 'needle', '\b')
不返回任何内容

以DB为单位的示例值:

haystack
---------
needless to say
this is a needle
so many (needle)
these are needles

当我使用类似干草堆的贝壳(“(?I)”,“针”)时,它会返回我所有的行,但我实际上是在寻找
这是一个针,在蜂巢中使用两个反斜杠:
\\b

演示:

结果:

haystack             _c1
needless to say      false
this is a needle     true
so many (needle)     true
these are needles    false

请注意,
这么多(针)
也是匹配的,因为
不是单词字符。

您是否在寻找一种逻辑,如-我应该先来,然后是针?然后您可以使用下面的逻辑-
,其中instr(col,'i')>0和instr(col,'needle')>0和instr(col,'i')
haystack             _c1
needless to say      false
this is a needle     true
so many (needle)     true
these are needles    false