On Thu, Oct 29, 2015 at 7:16 PM, Rob Sargent <robjsarg...@gmail.com> wrote:
> On 10/29/2015 05:01 PM, Tom Lane wrote: > > Eric Schwarzenbach <subscri...@blackbrook.org> <subscri...@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