Re: postgres function

From: Ramesh T <rameshparnanditech(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: postgres function
Date: 2015-10-15 14:05:35
Message-ID: CAK8Zd=vEoeMO0N57sHY3XZOGcLdS3_Jjb9OmMtwotEW_8NNRsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

'123-987-123' it is not fixed some times it may be '1233-9873-123-098'
as you said it's fixed,

changes the values in middle of the -

sometimes times i need 1233 and 098 or 9873,first position i'll find
direct for second variable we don't know where it's end with -

i.e ,
i need to find second postition of the variable between the '-'

On Thu, Oct 15, 2015 at 6:32 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Thu, Oct 15, 2015 at 8:32 AM, Ramesh T <rameshparnanditech(at)gmail(dot)com>
> wrote:
>
>> select position('-' in '123-987-123')
>> position
>> ---
>> 4
>> But I want second occurrence,
>> position
>> -------------
>> 8
>>
>> plz any help..?
>>
>>
> ​
> SELECT length((regexp_matches('123-987-123', '(\d{3}-\d{3}-)\d{3}'))[1])
> ​
>
> David J.
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dario Beraldi 2015-10-15 14:11:43 Re: Installing plpython3u
Previous Message AI Rumman 2015-10-15 13:59:37 pgpool ssl handshake failure