X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5F73DD1D09C for ; Fri, 23 Apr 2004 06:43:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38409-08 for ; Fri, 23 Apr 2004 06:43:48 -0300 (ADT) Received: from pw6tiger.de (pw6tiger.de [217.160.140.116]) by svr1.postgresql.org (Postfix) with SMTP id 398DAD1D088 for ; Fri, 23 Apr 2004 06:43:45 -0300 (ADT) Received: (qmail 29953 invoked by uid 505); 23 Apr 2004 09:43:46 -0000 Received: from vygen@gmx.de by planwerk6 by uid 89 with qmail-scanner-1.14 (virus scan: Clear:. Processed in 0.1774 secs); 23 Apr 2004 09:43:46 -0000 Received: from isi-dial-148-250.isionline-dialin.de (HELO 192.168.1.10) (vygen@planwerk6.de@195.158.148.250) by pw6tiger.de with SMTP; 23 Apr 2004 09:43:46 -0000 From: Janning Vygen 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 User-Agent: KMail/1.5.4 References: <200404230059.14221.vygen@gmx.de> <14819.1082687656@sss.pgh.pa.us> In-Reply-To: <14819.1082687656@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200404231137.21445.vygen@gmx.de> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=RCVD_NUMERIC_HELO X-Spam-Level: X-Archive-Number: 200404/252 X-Sequence-Number: 17627 Am Freitag, 23. April 2004 04:34 schrieb Tom Lane: > Janning Vygen 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