Re: regexp_matches where clause - PG 9.1

From: Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Subject: Re: regexp_matches where clause - PG 9.1
Date: 2017-04-07 02:18:53
Message-ID: CAG6W84+xBbLBk1K1mw-utn63Rct_enBr=Uf-90RSgerU4+Tq0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Apr 7, 2017 4:16 AM, "Patrick B" <patrickbakerbr(at)gmail(dot)com> wrote:

2017-04-07 14:08 GMT+12:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> On Thu, Apr 6, 2017 at 6:33 PM, Patrick B <patrickbakerbr(at)gmail(dot)com>
> wrote:
>
>> When actually I just want the 'main''
>>
>
> ​SELECT * FROM tbl WHERE path_name ~ '/main$' ?
>
> David J.
> ​
>

David,
That won't work.

When performing the select, I got:

/{s3bucket}/filesuser/client/27801123/attachment/4510/file/1113/small/main

when actually i want:

/{s3bucket}/filesuser/client/27801123/attachment/4510/main

Patrick.

WHERE (path_name)::text ~ '^/filesuser/client/\d+/attachment/\d+/main$'

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2017-04-07 02:19:38 Re: regexp_matches where clause - PG 9.1
Previous Message Arjen Nienhuis 2017-04-07 02:15:54 Re: regexp_matches where clause - PG 9.1