pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chester c young <chestercyoung@yahoo.com>
To: Michael Fuhr <mike@fuhr.org>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: regexp_replace usage
Date: Mon, 2 Oct 2006 08:15:03 -0700 (PDT)
Message-ID: <20061002151503.88141.qmail@web54309.mail.yahoo.com> (raw)
In-Reply-To: <20061002035609.GA42444@winnie.fuhr.org>

Thanks !

Michael Fuhr <mike@fuhr.org> wrote:Offhand I can't think of a way to do what you want with regexp_replace()
but you could use PL/Perl.  Something like this should work:

CREATE FUNCTION mcfix(text) RETURNS text AS $$
  $_[0] =~ s/\bMc([a-z])/Mc\u$1/g;
  return $_[0];
$$ LANGUAGE plperl IMMUTABLE STRICT;

SELECT mcfix('John Mcneil');
    mcfix    
-------------
 John McNeil
(1 row)


 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

view thread (3+ messages)

Message-ID: <20061002151503.88141.qmail@web54309.mail.yahoo.com>
Permalink:  ../20061002151503.88141.qmail@web54309.mail.yahoo.com/
Also on:    postgresql.org/message-id/20061002151503.88141.qmail@web54309.mail.yahoo.com

 · 

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: chestercyoung@yahoo.com, mike@fuhr.org
  Subject: Re: regexp_replace usage
  In-Reply-To: <20061002151503.88141.qmail@web54309.mail.yahoo.com>

* 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