Re: substring result

From: "Luis Silva" <lfs12(at)hotmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: substring result
Date: 2006-02-13 15:39:33
Message-ID: BAY18-F12B8742E32C8BE692AF172B5070@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Ok , I've used .....,'\\M.*','') tks again

>From: "Luis Silva" <lfs12(at)hotmail(dot)com>
>To: andreas(dot)kretschmer(at)schollglas(dot)com, pgsql-novice(at)postgresql(dot)org
>Subject: Re: [NOVICE] substring result
>Date: Mon, 13 Feb 2006 15:36:06 +0000
>
>HI!!! that worked fine, but is it possible to get 'name' and 'address'
>using the regexp_replace too? TKS A LOT again
>
>>From: "A. Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
>>To: pgsql-novice(at)postgresql(dot)org
>>Subject: Re: [NOVICE] substring result
>>Date: Mon, 13 Feb 2006 13:06:28 +0100
>>
>>am 13.02.2006, um 10:53:48 +0000 mailte Luis Silva folgendes:
>> >
>> > I there!! I'm trying to use regular expressions with postgresql. My
>> > objective is to get from a long string the information that I need.
>> > For example
>> >
>> > "name='joe' , address='portugal' " and I need to get 'joe' and
>>'portugal'.
>> > can I do it with select substring()? if I can,how? tks a lot
>>
>>test=# select * from foo;
>> string
>>---------------------------------
>> name='joe' , address='portugal'
>>(1 row)
>>
>>
>>Write a function:
>>- count the fields separeted by ',' and then for every field:
>>
>>
>>test=# select regexp_replace(split_part(string,',',1), '\\m.*=', '') from
>>foo;
>> regexp_replace
>>----------------
>> 'joe'
>>(1 row)
>>
>>test=# select regexp_replace(split_part(string,',',2), '\\m.*=', '') from
>>foo;
>> regexp_replace
>>----------------
>> 'portugal'
>>(1 row)
>>
>>
>>You can with trim() remove spaces if you need.
>>
>>
>>
>>HTH, Andreas
>>--
>>Andreas Kretschmer (Kontakt: siehe Header)
>>Heynitz: 035242/47215, D1: 0160/7141639
>>GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
>> === Schollglas Unternehmensgruppe ===
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 6: explain analyze is your friend
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Pradeep Parmar 2006-02-15 05:55:03 one table from the db on a separate drive
Previous Message Luis Silva 2006-02-13 15:36:06 Re: substring result