我目前的查询是:
SELECT * FROM "Questions" WHERE "questionText" ~ '[ $][_][$ ]' AND "status" != 'inactive';这将返回:
我只想用2(或更多) _返回像第二和第四关怀这样的项目。我不想在彼此之间返回多个____。
发布于 2016-06-30 21:03:43
像这样的怎么样?
WITH questions (questionText, status) AS (
VALUES
('Jill was shocked to find that she _ none of the answers in the test.','active'),
('Brooklyn stood joyously _ her crown proudly _ top _ her head','active'),
('A healthy diet is a _ idea.','active'),
('I _ watch a _ movie.','active')
)
SELECT questionText
FROM questions
WHERE array_length(regexp_split_to_array(questionText,'[ $][_][$ ]'),1) > 2
AND status != 'inactive'; 输出

https://stackoverflow.com/questions/38133011
复制相似问题