From: Janning Vygen <vygen@gmx.de>
To: pgsql-sql@postgresql.org
Subject: Re: Is there an easy way to normalize-space with given string functions
Date: Fri, 23 Apr 2004 11:37:21 +0200
Message-ID: <200404231137.21445.vygen@gmx.de> (raw)
In-Reply-To: <14819.1082687656@sss.pgh.pa.us>
References: <200404230059.14221.vygen@gmx.de>
<14819.1082687656@sss.pgh.pa.us>
Am Freitag, 23. April 2004 04:34 schrieb Tom Lane:
> Janning Vygen <vygen@gmx.de> writes:
> > i searched the function list and tried to combine to or more
> > functions, but i miss a replace function which uses regular
> > expressions.
>
> There isn't one in the SQL standard. Most people who need one write a
> one-liner function in plperl or pltcl.
Thank you.
> (Mind you, I don't know why we don't offer a built-in one --- the needed
> regex engine is in there anyway. I guess no one has gotten around to
> getting agreement on a syntax.)
My suggestion:
Syntax:
substitute(string text, from text, to text);
Example:
substitute(' too many spaces ', '\s+', ' ');
Result:
' too many spaces '
But maybe its a bad idea to create new function names...
kind regards
janning
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: vygen@gmx.de
Subject: Re: Is there an easy way to normalize-space with given string functions
In-Reply-To: <200404231137.21445.vygen@gmx.de>
* 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