Re: regex failing

Поиск
Список
Период
Сортировка
От Steve Baldwin
Тема Re: regex failing
Дата
Msg-id CAKE1AiYPrDhzn_yyhy0Sfdij2XgtpkCzG4CXuLAoSKAh3=aOKg@mail.gmail.com
обсуждение исходный текст
Ответ на regex failing  (Zahir Lalani <ZahirLalani@oliver.agency>)
Список pgsql-general
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

 

В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: regex failing
Следующее
От: Sergey Fukanchik
Дата:
Сообщение: Re: regex failing