Re: Regexp_replace help

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Chris Hoover <chrish(at)aweber(dot)com>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Regexp_replace help
Date: 2024-09-12 21:22:54
Message-ID: CAKFQuwaasAeLsZHfdS+3vCAxumLRbyfNHaX7+xbeqjYK-jz5Qw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thursday, September 12, 2024, Chris Hoover <chrish(at)aweber(dot)com> wrote:

>
> SELECT regexp_replace(’This is my second test string and it is causing
> code1234 from def. The weather is nice. :)’,
> ‘ code[0-9]+? .*’,
> ‘What should this be so I keep
> the code1234?’)
> Desire result:
> ‘This is my second test string and it is causing code1234’
>

Probably easier to just regexp_match “^(.+?code\d+)\b”, and keep the
contents of group 1.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Wells Oliver 2024-09-12 22:51:50 Query plan getting less efficient over time with frequent updates and deletes..
Previous Message Chris Hoover 2024-09-12 21:18:30 Regexp_replace help