Re: BUG #10889: Cannot add 2 floats from regular expression

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #10889: Cannot add 2 floats from regular expression
Date: 2014-07-07 16:36:32
Message-ID: 53BACC90.3080609@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 7/7/14 5:25 PM, David G Johnston wrote:
> SELECT
> (SELECT (regexp_matches('1.3', '([0-9\.]*)'))[1])::float
> +
> (SELECT (regexp_matches('2.3', '([0-9\.]*)'))[1])::float
> ;
>
> Suggest wrapping it in a function - or making a "regexp_matches_single"
> function that behaves similarly but returns a single text[] instead of a
> SETOF text[]

In this case, it would be easier to use substring(string from pattern).

.marko

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Mitu Verma 2014-07-07 17:18:23 Re: BUG #10888: application is getting hanged in the poll() function of libpq.so.
Previous Message David G Johnston 2014-07-07 15:58:26 Re: BUG #10889: Cannot add 2 floats from regular expression