Re: Regexp_replace help - Mailing list pgsql-admin

From David G. Johnston
Subject Re: Regexp_replace help
Date
Msg-id CAKFQuwaasAeLsZHfdS+3vCAxumLRbyfNHaX7+xbeqjYK-jz5Qw@mail.gmail.com
Whole thread Raw
In response to Regexp_replace help  (Chris Hoover <chrish@aweber.com>)
List pgsql-admin
On Thursday, September 12, 2024, Chris Hoover <chrish@aweber.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.


pgsql-admin by date:

Previous
From: Chris Hoover
Date:
Subject: Regexp_replace help
Next
From: Wells Oliver
Date:
Subject: Query plan getting less efficient over time with frequent updates and deletes..