From: | Patrick B <patrickbakerbr(at)gmail(dot)com> |
---|---|
To: | Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: regexp_matches where clause - PG 9.1 |
Date: | 2017-04-06 06:10:57 |
Message-ID: | CAJNY3isW5Sn8w81JWcndouEqVqDx5JFd3notG_2Ei6=_DZXH0A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2017-04-06 17:35 GMT+12:00 Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com>:
>
>
> On Apr 6, 2017 05:57, "Patrick B" <patrickbakerbr(at)gmail(dot)com> wrote:
>
> Hi guys,
>
> i've got this column:
>
> path_name character varying(255)
>>
>
> I store full S3 bucket path for the attachments of my application on it;
> example:
>
> /{s3bucket}/filesuser/client/27801123/attachment/4510/main
>>
> /{s3bucket}/filesuser/client/27801123/attachment/4510/file
>>
>
>
> I wanna do a select, where path_name has only 'main' and not anything else.
>
>
> WHERE path_nane LIKE '%/main'
>
>
>
I was able to do it like this:
WHERE (path_name)::text ~
> '^\/filesuser\/client/\d+/(attachment)/\d+/(main)+'
Thanks
Patrick.
From | Date | Subject | |
---|---|---|---|
Next Message | Ertan Küçükoğlu | 2017-04-06 10:27:23 | Re: Advise on primary key for detail tables (OS: Raspberry Pi) |
Previous Message | Arjen Nienhuis | 2017-04-06 05:35:41 | Re: regexp_matches where clause - PG 9.1 |