From: | Darren Ferguson <darren(at)thread(dot)crystalballinc(dot)com> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | Dave Smith <dave(dot)smith(at)candata(dot)com>, "PostgreSQL-General-List (E-mail)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Removing spaces |
Date: | 2003-02-19 21:25:08 |
Message-ID: | Pine.LNX.4.44.0302191624380.24043-100000@thread.crystalballinc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Don't know if this is what you are looking for but the following will
remove them
select translate('hello \nworld \n',' ','');
HTH
Darren
On Wed, 19 Feb 2003, Richard Huxton wrote:
> On Wednesday 19 Feb 2003 5:07 pm, Dave Smith wrote:
> > I have a field of type text that has a value like
> >
> > 'hello \nworld \n'
> >
> > I would like to remove the trailing blanks between the last character
> > and the newline. I would like to use replace with a regx like
> > /[ ]+\n/\n/ but it does not seem to work.
>
> The replace function doesn't handle regexps AFAIK - you could look at
> SUBSTRING() in the POSIX Regexp section of the functions reference but I
> don't think that's going to do it either.
>
> The problem is you seem to want to remove spaces after "hello" and "world" - I
> think that means you need perl regexps or a loop.
>
> Unless some posix guru steps forward, I'd say the easiest way is to build a
> loop that repeatedly calls replace(my_string,' \n','\n')
>
--
Darren Ferguson
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2003-02-19 21:52:31 | Re: How do I upgrade or coexist PostgreSQL on a Cobalt XTR system? |
Previous Message | Marc G. Fournier | 2003-02-19 21:24:56 | Re: techdocs broken again. |