pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Campbell, Lance <lance@illinois.edu>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Help with a not match
Date: Fri, 9 Nov 2018 17:59:07 +0000
Message-ID: <F155F457-310F-41FC-B3F5-9544D22A5C77@illinois.edu> (raw)
In-Reply-To: <CAKFQuwZntFfvhrobCSwPV1jN=JjkGLRRKsy317dHu4B+4FKqCQ@mail.gmail.com>
References: <E48BCA4C-5847-4634-8E9D-A91C9C4E40E6@illinois.edu>
	<CAKFQuwaSZyaiKpo1wfWWnuwfdYvqnM3ePjNxPXBt+o5TNUHEFA@mail.gmail.com>
	<47589FBF-7910-4F95-8239-BDF702A19B2C@illinois.edu>
	<CAKFQuwZntFfvhrobCSwPV1jN=JjkGLRRKsy317dHu4B+4FKqCQ@mail.gmail.com>

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.
    



view thread (7+ messages)  latest in thread

Message-ID: <F155F457-310F-41FC-B3F5-9544D22A5C77@illinois.edu>
Permalink:  ../F155F457-310F-41FC-B3F5-9544D22A5C77@illinois.edu/
Also on:    postgresql.org/message-id/F155F457-310F-41FC-B3F5-9544D22A5C77@illinois.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lance@illinois.edu, david.g.johnston@gmail.com
  Subject: Re: Help with a not match
  In-Reply-To: <F155F457-310F-41FC-B3F5-9544D22A5C77@illinois.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox