From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: Need a help in regexp
Date: Thu, 6 May 2010 17:04:47 +0200
Message-ID: <20100506150447.GA28724@a-kretschmer.de> (raw)
In-Reply-To: <k2oe13d0d11005060748l4eaf0ac2g9b1db464c524b8e4@mail.gmail.com>
References: <k2oe13d0d11005060748l4eaf0ac2g9b1db464c524b8e4@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: andreas.kretschmer@schollglas.com
Subject: Re: Need a help in regexp
In-Reply-To: <20100506150447.GA28724@a-kretschmer.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox