pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hélder M. Vieira <hmv@mail.telepac.pt>
To: pgsql-sql@postgresql.org
Subject: Re: how to do a find and replace
Date: Fri, 18 Nov 2005 01:10:17 -0000
Message-ID: <06c001c5ebdc$d6d4cd10$580bfea9@hmv02> (raw)
References: <1132269492.30942.20.camel@dev11dt.corp.localmatters.com>
	<5d001d303f001ea0847254c3f0a352d9@squeegeemedia.com>
	<437D1862.2060402@PresiNET.com>
	<be1d8fb1d0b1bb5cf79b8e73b66b5609@squeegeemedia.com>

> update media_instance set location=replace(location,'v.','')
> where location like '%/0/v.%'


For more complex search/replace operations, 8.1 provides an interesting 
function, named 'regexp_replace'.
It probably goes unnoticed because although there is a small reference in 
the manual in section 'E.1.3.6. Data Type and Function Changes'
(http://www.postgresql.org/docs/8.1/interactive/release.html#RELEASE-8-1) 
and a description in section '9.7.3 POSIX Regular expressions' 
(http://www.postgresql.org/docs/8.1/interactive/functions-matching.html), it 
isn't mentioned in section '9.4. String Functions and Operators' 
(http://www.postgresql.org/docs/8.1/interactive/functions-string.html).


Hélder M. Vieira











view thread (8+ messages)  latest in thread

Message-ID: <06c001c5ebdc$d6d4cd10$580bfea9@hmv02>
Permalink:  ../06c001c5ebdc$d6d4cd10$580bfea9@hmv02/
Also on:    postgresql.org/message-id/06c001c5ebdc$d6d4cd10$580bfea9@hmv02

 · 

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: pgsql-sql@postgresql.org
  Cc: hmv@mail.telepac.pt
  Subject: Re: how to do a find and replace
  In-Reply-To: <06c001c5ebdc$d6d4cd10$580bfea9@hmv02>

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

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