Re: Fwd: help on postgres regexp

From: Thom Brown <thombrown(at)gmail(dot)com>
To: Nicholas I <nicholas(dot)domnic(dot)i(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Fwd: help on postgres regexp
Date: 2010-05-06 15:03:14
Message-ID: i2sbddc86151005060803x3b9c3a89lef7b0743513d1aec@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6 May 2010 15:52, Nicholas I <nicholas(dot)domnic(dot)i(at)gmail(dot)com> wrote:

>
>
> ---------- Forwarded message ----------
> From: Nicholas I <nicholas(dot)domnic(dot)i(at)gmail(dot)com>
> Date: Wed, May 5, 2010 at 8:35 AM
> Subject: help
> To: pgsql-sql(at)postgresql(dot)org
>
>
> Hi,
>
> I have a table in which the data's are entered like,
>
> Example:
>
> One (1)
> Two (2)
> Three (3)
>
> I want to extract the data which is only within the parentheses.
>
> that is
> 1
> 2
> 3
>
>
> Thank You
> Nicholas I
>
>
>
Use a regular expression:

SELECT substring('this is a test(22)' from '\([0-9]+\)');

This would return 22.

Regards

Thom

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2010-05-06 15:04:47 Re: Need a help in regexp
Previous Message Nicholas I 2010-05-06 14:53:01 Fwd: Need a help in regexp