Re: Postgresql: Remove last char in text-field if the column ends with minus sign

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Sarang Dave <saranghdave(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql: Remove last char in text-field if the column ends with minus sign
Date: 2010-12-16 18:02:10
Message-ID: 4D0A5422.2020108@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/16/2010 06:52 AM, Sarang Dave wrote:
>
> Hello sir,
>
> I want to remove the last char in a column if it ends with the minus
> sign. How could I do this in postgresql?
>
>
regexp_replace(your_field, '-+$', '');

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2010-12-16 18:12:35 PgEast 2011: NYC CFP
Previous Message Vincent Veyron 2010-12-16 17:26:40 Re: Searing array fields - or should I redesign?