Re: Domain check constraint not honored?

Поиск
Список
Период
Сортировка
От Dane Foster
Тема Re: Domain check constraint not honored?
Дата
Msg-id CA+WxinK+xrYgB3dmnnmcWCk9W6aQGkwsHXsQDe_=CSOFeLGuzA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Domain check constraint not honored?  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-general
On Thu, Oct 29, 2015 at 7:16 PM, Rob Sargent <robjsargent@gmail.com> wrote:
On 10/29/2015 05:01 PM, Tom Lane wrote:
Eric Schwarzenbach <subscriber@blackbrook.org> writes:
... (Also FWIW, the latest version of 
this regexp is now '^([0-9]+.)*[0-9]+$')
Um, that's not gonna do what you want at all.  Outside brackets, a dot
is a wildcard.  (Regex syntax is a mess :-(.)
		regards, tom lane


arg. back to level two of regexpness for me :(  I read it as ^[0-9.]+

​If I understand your regex needs correctly you want to allow digits separated by dots (like IPv4 octets) but never start w/ or end w/ a dot nor any non digit character other than a dot. If that's the case this may work. I say may because I'm using PCRE syntax and I don't know how much of it PostgreSQL supports.

^(?>\d+)(?>\.\d+)*$

If there is no support for atomic groups you can try this: ^(?:\d++)(?:\.\d++)*$

And if there is no support for greedy quantifiers nor non capturing groups: ^(\d+)(\.\d++)*$

I hoped that helped.

Good luck,

Dane


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

Предыдущее
От: Dane Foster
Дата:
Сообщение: Re: mysql_fdw trouble
Следующее
От: Dane Foster
Дата:
Сообщение: Re: mysql_fdw trouble