Re: Find and replace

From: "Campbell, Lance" <lance(at)illinois(dot)edu>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Find and replace
Date: 2019-09-11 20:31:09
Message-ID: 9785FB9B-A4F0-4820-812F-91A233DA0A9A@illinois.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I don’t think that is an option. The text I am doing the find and replace on contains CSS. I believe there will be squiggly brackets in the CSS. However, it should have spaces or carriage return line feeds between the brackets so there will not be any issues.

From: Rob Sargent <robjsargent(at)gmail(dot)com>
Date: Wednesday, September 11, 2019 at 3:27 PM
To: Lance Campbell <lance(at)illinois(dot)edu>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Find and replace

On Sep 11, 2019, at 2:24 PM, Campbell, Lance <lance(at)illinois(dot)edu<mailto:lance(at)illinois(dot)edu>> wrote:

PostgreSQL 10.x

I don’t know the best way to do this. I need to do a find and replace in text fields. The value I need to find and replace may occur more than once in each field per record.

The value I am trying to match on:
Starts with a single { .
Ends with a single } .
In between these brackets can be the characters 0-9, a-z, A-Z, hyphens and underscores. But no spaces. These characters could be in any order.
The replacement value on a match is the same as what was found except for double {{ at the beginning and double }} at the end. Same values between the brackets as what was matched on.

Example:
{ab_1D3-4} becomes {{ab_1D3-4}}

Thanks for helping me with this.

Lance Campbell
University of Illinois

Are there curly braces which don’t start/end such strings? If not it might be easier to just double them up?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2019-09-11 20:49:35 Re: Find and replace
Previous Message Rob Sargent 2019-09-11 20:27:48 Re: Find and replace