Re: Pattern Matching question - PG 9.6

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Pattern Matching question - PG 9.6
Date: 2017-05-15 04:38:58
Message-ID: CAKFQuwaLMV3yL1jfK4s6q-gVnExGL8hjgTUcnjh-kTQE+y0oBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sunday, May 14, 2017, Patrick B <patrickbakerbr(at)gmail(dot)com> wrote:

>
> I thought I have already explained it. Here it goes again. Demo page is:
> http://dbfiddle.uk/?rdbms=postgres_9.6&fiddle=ea61e7e1859bdb
> 7f297f853a9dc0e3d0
>
>
Now that you've posted the right link it becomes a bit easier to follow...

>
> To summarize: I wanna use a pattern matching the only returns these rows:
>
> /testfile/client/10/attachment/1000/master/
> /testfile/client/10/attachment/unassigned/file/1001/master
> /testfile/client/10/attachment/unassigned/file/1002/master
>
> Why isn't 7 valid?

Requiring that the last directory be the word master, with or without a
forward slash, is simple enough but 7 matches that. Just tack the
following onto the end of your existing pattern.

.+master/?$

You'll need to be more verbose and literal if you truly want to exclude 7.
Just add more path separators and patterns like [^/]+ until you get what
you want.

I'd be more helpful but my iPad and the fiddle don't seem to play nicely
together...

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message matshyeq 2017-05-15 10:34:31 Re: Pattern Matching question - PG 9.6
Previous Message Patrick B 2017-05-15 04:21:30 Re: Pattern Matching question - PG 9.6