Search Postgresql Archives

Re: Domain check constraint not honored?

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

 



On Thu, Oct 29, 2015 at 7:16 PM, Rob Sargent <robjsargent@xxxxxxxxx> wrote:
On 10/29/2015 05:01 PM, Tom Lane wrote:
Eric Schwarzenbach <subscriber@xxxxxxxxxxxxxx> 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



[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