Search Postgresql Archives

Re: Splitting a string containing a numeric value in to three parts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sanjaya Vithanagama <svithanagama@xxxxxxxxx> wrote:

> I can match the numeric value and the rest of the string after
> the numeric value using the following:
>
> select regexp_matches('hello+123123.453the-123re',
>                                            '([\+|-]?(?:\d*(?:(?:\.)?\d+)))(.*)')
> outputs array {+123123.453,the-123re}.
>
> Where I am having trouble is with matching the first part of the
> string. In other words what needs to be 'RE' in the following
> expression for it to report the all three elements of the array.
>
> select regexp_matches('hello+123123.453the-123re',
>                                             '((RE)[\+|-]?(?:\d*(?:(?:\.)?\d+)))(.*)')
> should return array {hello,+123123.453,the-123re}.

select regexp_matches('hello+123123.453the-123re',
                      '^(.*?)([\+|-]?(?:\d*(?:(?:\.)?\d+)))(.*)$')

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux