Regex 正则表达式和文本匹配问题
我正在Postgres 9.3.5.0中进行一些基本的文本匹配。Regex 正则表达式和文本匹配问题,regex,postgresql,pattern-matching,Regex,Postgresql,Pattern Matching,我正在Postgres 9.3.5.0中进行一些基本的文本匹配。 以下是我目前的代码: Select text from eightks WHERE other_events = true and keywordRegexs = [\y(director and member \s+ and resigned)\y/ix]; 我得到以下错误 我正在尝试查找包含这些精确短语的文档。Postgres中的正则表达式匹配运算符是~ 不区分大小写的变体是~* 分支包含在()中 问题中“那
以下是我目前的代码:
Select text from eightks
WHERE other_events = true and
keywordRegexs = [\y(director and member \s+ and resigned)\y/ix];
我得到以下错误
我正在尝试查找包含这些精确短语的文档。Postgres中的正则表达式匹配运算符是
~
不区分大小写的变体是
~*
分支包含在
()
中
问题中“那些确切的短语”的含义不清楚。还有欧文的观点。。。正则表达式是文字,必须引用。谢谢@Erwinbrandstetter。我应该更清楚确切的词组。我的意思是想要创建包含单词、director和member的文档,在这种情况下,正则表达式语法支持单词边界标记;你可能应该用那些。
psql:test3.sql:3: invalid command \y(director
psql:test3.sql:5: ERROR: syntax error at or near "["
LINE 3: keywordRegexs = [
SELECT text
FROM eightks
WHERE other_events = true
AND keywordregexs ~* '(\y(director | member \s+ |resigned)\y)';