From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Need a help in regexp |
Date: | 2010-05-06 15:04:47 |
Message-ID: | 20100506150447.GA28724@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
In response to Nicholas I :
> Hi,
>
> Need a help in regexp!
>
> 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
>
> i have written a query,
> select regexp_matches(name,'([^(]+)([)]+)','g') from table;
> which outputs the data as,
> {"test"}
> {"test2"}
>
>
> Thank You
> Nicholas I
test=*# select * from regex ;
t
-----------
one (1)
two (2)
three (3)
(3 Zeilen)
Zeit: 0,262 ms
test=*# select regexp_replace(t, '[^0-9]','','g') from regex;
regexp_replace
----------------
1
2
3
(3 Zeilen)
Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
From | Date | Subject | |
---|---|---|---|
Next Message | Thom Brown | 2010-05-06 15:11:56 | Re: I need to take metadata from a shell script. |
Previous Message | Thom Brown | 2010-05-06 15:03:14 | Re: Fwd: help on postgres regexp |
From | Date | Subject | |
---|---|---|---|
Next Message | Leif Biberg Kristensen | 2010-05-06 15:37:52 | Re: Need a help in regexp |
Previous Message | Nicholas I | 2010-05-06 14:53:01 | Fwd: Need a help in regexp |