Re: BUG #10889: Cannot add 2 floats from regular expression - Mailing list pgsql-bugs

From Marko Tiikkaja
Subject Re: BUG #10889: Cannot add 2 floats from regular expression
Date
Msg-id 53BACC90.3080609@joh.to
Whole thread Raw
In response to Re: BUG #10889: Cannot add 2 floats from regular expression  (David G Johnston <david.g.johnston@gmail.com>)
List 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

pgsql-bugs by date:

Previous
From: David G Johnston
Date:
Subject: Re: BUG #10889: Cannot add 2 floats from regular expression
Next
From: Tom Lane
Date:
Subject: Re: BUG #10888: application is getting hanged in the poll() function of libpq.so.