View Single Post

   
  #5 (permalink)  
Old 04-29-2008, 09:32 PM
Tom Lane
 
Posts: n/a
Default Re: trim(both) problem?

"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

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply With Quote