Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 541ED2E0040 for ; Mon, 28 Apr 2008 10:19:16 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 17908-10 for ; Mon, 28 Apr 2008 10:19:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from perseverance.services.encs.concordia.ca (perseverance-96.encs.concordia.ca [132.205.96.94]) by developer.postgresql.org (Postfix) with ESMTP id 5EF2A2E0038 for ; Mon, 28 Apr 2008 10:19:11 -0300 (ADT) Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by perseverance.services.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id m3SDJ3Oj017494; Mon, 28 Apr 2008 09:19:03 -0400 Message-ID: <4815CEC7.4060405@encs.concordia.ca> Date: Mon, 28 Apr 2008 09:19:03 -0400 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Tom Lane CC: Fernando Hevia , pgsql-sql@postgresql.org Subject: Re: trim(both) problem? References: <4812402D.7080404@encs.concordia.ca> <20080425134220.S8763@megazone.bigpanda.com> <031701c8a717$c7458e90$8f01010a@iptel.com.ar> <751.1209158787@sss.pgh.pa.us> In-Reply-To: <751.1209158787@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on perseverance.encs.concordia.ca at 2008/04/28 09:19:04 EDT X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/212 X-Sequence-Number: 30751 Thanks a lot for all help! I understand how trim work now. >> You could probably use instead: >> select replace('
ROI Engineering Inc.', '
', '') > That would zap occurrences in the middle of the string, though. > regexp_replace would be better since it'd allow anchoring the > pattern, eg > > select regexp_replace('
ROI Engineering Inc.', '^
', ''); > select regexp_replace('ROI Engineering Inc.
', '
$', ''); This is exactly I am looking for, but my version PostgreSQL 8.0.15 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.2 does not support this func, and have to think about the other way to 'trim' the ^
&
$ Thank you again!