On Thu, Oct 29, 2015 at 7:16 PM, Rob Sargent <robjsargent@xxxxxxxxx> wrote:
If there is no support for atomic groups you can try this: ^(?:\d++)(?:\.\d++)*$
On 10/29/2015 05:01 PM, Tom Lane wrote:
arg. back to level two of regexpness for me :( I read it as ^[0-9.]+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
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+)*$
And if there is no support for greedy quantifiers nor non capturing groups: ^(\d+)(\.\d++)*$
I hoped that helped.
Good luck,
Dane