Re: Help with a not match

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Campbell, Lance" <lance(at)illinois(dot)edu>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Help with a not match
Date: 2018-11-09 17:22:38
Message-ID: CAKFQuwZntFfvhrobCSwPV1jN=JjkGLRRKsy317dHu4B+4FKqCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

The convention on these lists is to bottom-post and trim unnecessary context.

On Fri, Nov 9, 2018 at 10:08 AM Campbell, Lance <lance(at)illinois(dot)edu> wrote:
> The SQL you provided is the opposite of what I was looking for. Thanks though.

See if these help you:

SELECT * FROM regexp_matches('/123/ /456/', '/(?!123)(\d+)/', 'g');
SELECT * FROM regexp_matches('/123/', '/(?!123)(\d+)/', 'g');
SELECT * FROM regexp_matches('/456/', '/(?!123)(\d+)/', 'g');

Your main problem is the scenario where the desired string does exist
but then others that are unexpected exist as well. Without that its
as simple as locating ones with the correct string and then negating
the result. You may find you want to use multiple tests and combine
them with AND/OR.

David J.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Campbell, Lance 2018-11-09 17:59:07 Re: Help with a not match
Previous Message Campbell, Lance 2018-11-09 17:08:08 Re: Help with a not match