From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fernando Hevia <fhevia@ip-tel.com.ar>
Cc: 'Emi Lu' <emilu@encs.concordia.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: trim(both) problem?
Date: Fri, 25 Apr 2008 17:26:27 -0400
Message-ID: <751.1209158787@sss.pgh.pa.us> (raw)
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>
"Fernando Hevia" <fhevia@ip-tel.com.ar> writes:
>> Trim doesn't do what you think it does. The '<BR/>' 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('<BR/>ROI Engineering Inc.', '<BR/>', '')
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('<BR/>ROI Engineering Inc.', '^<BR/>', '');
select regexp_replace('ROI Engineering Inc.<BR/>', '<BR/>$', '');
regards, tom lane
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: tgl@sss.pgh.pa.us, fhevia@ip-tel.com.ar, emilu@encs.concordia.ca
Subject: Re: trim(both) problem?
In-Reply-To: <751.1209158787@sss.pgh.pa.us>
* 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