From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: Removing whitespace using regexp_replace
Date: Sun, 28 Oct 2007 15:35:59 +0100
Message-ID: <fg26oe$dfg$1@ger.gmane.org> (raw)
In-Reply-To: <20071028123254.GB17410@KanotixBox>
References: <fg1ra3$ehj$1@ger.gmane.org>
<20071028114247.GA1327@KanotixBox>
<fg1ugo$m6v$1@ger.gmane.org>
<20071028123254.GB17410@KanotixBox>
Andreas Kretschmer wrote on 28.10.2007 13:32:
>> But it seems my problem was actually caused by something else:
>>
>> SELECT regexp_replace(myfield, '\s*', '', 'g')
>> FROM mytable;
>
> you should escape the \, change to ...'\\s*'...
Ah! Didn't think this was necessary, as \t or \n did not need to be escaped.
> But without anchors this replaces all whitespaces, also within the text
> and not only at the beginning/end (^ and $)
Yes of course, this was only for testing ;)
Thanks for your help!
Thomas
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: spam_eater@gmx.net
Subject: Re: Removing whitespace using regexp_replace
In-Reply-To: <fg26oe$dfg$1@ger.gmane.org>
* 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