Search Postgresql Archives

Re: regex failing

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

 



Probably not much help but it seems to work ok for me (unless I'm doing something stupid). You didn't actually say how/where you were doing the regex match, but the '~' operator seems to work ok.

[~/git/caas-sqs-consumer] psql
psql (15.3 (Homebrew), server 13.7)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, compression: off)
Type "help" for help.

bcaas=> select '1234:56' ~ '^([0-9]+[.]?[0-9]*)$';
 ?column?
----------
 f
(1 row)

bcaas=> select '1234.56' ~ '^([0-9]+[.]?[0-9]*)$';
 ?column?
----------
 t
(1 row)

On Wed, Jun 28, 2023 at 4:59 AM Zahir Lalani <ZahirLalani@oliver.agency> wrote:

Hi All

 

Got a weird one. I am using the regex below to case match numeric only values.

 

'^([0-9]+[.]?[0-9]*)$'

 

This works well by and large but not for a value like “1234:567”. This seems to match positive and then fails due to not being an actual number in the subsequent cast.

 

Any ideas? (PG13)

 

Z

 


[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 Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux