2

Does anyone know how to remove a record from DB according to the regexp pattern? So now I have found all the required data for removal like so:

SELECT code, regexp_matches(code, '^(?!([EHIVPZ])).*') code
FROM "sku";

but cannot figure out how to remove them properly?

1
  • Please provide sample data and desired results. Commented Dec 2, 2020 at 12:05

1 Answer 1

3

Why not just put the pattern into a delete statement?

delete from sku
    where code ~ '^(?!([EHIVPZ])).*')
Sign up to request clarification or add additional context in comments.

1 Comment

oh ~ of course, I completely forgot this. Thank you @Gordon Linoff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.