Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 861D42E005D for ; Fri, 25 Apr 2008 18:26:49 -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 75669-10 for ; Fri, 25 Apr 2008 18:26:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id 0A7182E0033 for ; Fri, 25 Apr 2008 18:26:44 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m3PLQRjf000752; Fri, 25 Apr 2008 17:26:27 -0400 (EDT) To: "Fernando Hevia" cc: "'Emi Lu'" , pgsql-sql@postgresql.org Subject: Re: trim(both) problem? In-reply-to: <031701c8a717$c7458e90$8f01010a@iptel.com.ar> References: <4812402D.7080404@encs.concordia.ca> <20080425134220.S8763@megazone.bigpanda.com> <031701c8a717$c7458e90$8f01010a@iptel.com.ar> Comments: In-reply-to "Fernando Hevia" message dated "Fri, 25 Apr 2008 18:03:14 -0300" Date: Fri, 25 Apr 2008 17:26:27 -0400 Message-ID: <751.1209158787@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/178 X-Sequence-Number: 30717 "Fernando Hevia" writes: >> Trim doesn't do what you think it does. The '
' in the >> above is not a string to remove it is a list of characters to >> remove. Thus, the R is removed as it matches a character given. > 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.
', '
$', ''); regards, tom lane