Re: Removing whitespace using regexp_replace - Mailing list pgsql-sql

From Thomas Kellerer
Subject Re: Removing whitespace using regexp_replace
Date
Msg-id fg26oe$dfg$1@ger.gmane.org
Whole thread Raw
In response to Re: Removing whitespace using regexp_replace  (Andreas Kretschmer <akretschmer@spamfence.net>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Removing whitespace using regexp_replace
Next
From: Paul Lambert
Date:
Subject: Select into with dynamic criteria in a plpgsql function