我目前的查询是:
SELECT * FROM "Questions" WHERE "questionText" ~ '[ $][_][$ ]' AND "status" != 'inactive';
返回:
我只想用2(或更多)_
返回第二和第四次护理等项目。我不想让多个____
彼此相邻。
答案 0 :(得分:1)
这样的事情怎么样?
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';
<强>输出强>