Re: How to remove "enter" or new line

From: Thom Brown <thom(at)linux(dot)com>
To: paulo matadr <saddoness(at)yahoo(dot)com(dot)br>
Cc: GENERAL <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to remove "enter" or new line
Date: 2010-10-14 15:35:03
Message-ID: AANLkTinE7xFPywx9TT8qo+Y0BaFjAgiWVOet+FFtYh_s@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14 October 2010 14:59, paulo matadr <saddoness(at)yahoo(dot)com(dot)br> wrote:
>
> Hi Gurus,
>
>
> How to remove "enter" or new line from varchar field, I believed  be chr(10)
> and chr(13).

You can use regexp_replace. For example:

regexp_replace(column, '\r|\n', '', 'g')

Bear in mind, the above example would mean that if there was no
whitespace between the newline and the words either side of it, they
would effectively be concatenated, so you may wish to replace with a
space, or use a better regular expression.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-10-14 16:41:04 Re: [GENERAL] pg_filedump binary for CentOS
Previous Message Rob Sargent 2010-10-14 14:56:15 Re: Adding a New Column Specifically In a Table