public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Chris Hoover <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Regexp_replace help
Date: Thu, 12 Sep 2024 14:22:54 -0700
Message-ID: <CAKFQuwaasAeLsZHfdS+3vCAxumLRbyfNHaX7+xbeqjYK-jz5Qw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Thursday, September 12, 2024, Chris Hoover <[email protected]> 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.


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Regexp_replace help
  In-Reply-To: <CAKFQuwaasAeLsZHfdS+3vCAxumLRbyfNHaX7+xbeqjYK-jz5Qw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox