Re: Help with a not match - Mailing list pgsql-sql

From Campbell, Lance
Subject Re: Help with a not match
Date
Msg-id F155F457-310F-41FC-B3F5-9544D22A5C77@illinois.edu
Whole thread Raw
In response to Re: Help with a not match  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Help with a not match  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Help with a not match  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-sql
Very helpful.  I am almost there.  

I created this SQL:

SELECT regexp_matches(content, '/(?!files/'||id||'/)(files/\d+/)/', 'g') FROM tablea

I get no matches.  My guess is I am close but slightly off on the syntax.

Lance

On 11/9/18, 11:22 AM, "David G. Johnston" <david.g.johnston@gmail.com> wrote:

    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@illinois.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.
    


pgsql-sql by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Help with a not match
Next
From: "David G. Johnston"
Date:
Subject: Re: Help with a not match