Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread Mike Christensen
Yea looks like Postgres has it right, well.. per POSIX standard anyway. JavaScript also has it right, as does Python and .NET. Ruby is just weird. On Thu, Jul 24, 2014 at 1:57 PM, Tom Lane wrote: > Mike Christensen writes: > > I'm curious why this query returns 0: > > SELECT 'AAA' ~ '^A{,4}$

Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread Tom Lane
Mike Christensen writes: > I'm curious why this query returns 0: > SELECT 'AAA' ~ '^A{,4}$' > Yet, this query returns 1: > SELECT 'AAA' ~ '^A{0,4}$' > Is this a bug with the regular expression engine? Our regex documentation lists the following variants of bounds syntax: {m} {m,} {

Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread Mike Christensen
Yea seems right. I was testing the expression on Rubular (Which uses the Ruby parser) and it worked. I guess Ruby allows this non-standard expression with the missing lower bounds. Every reference I could find, though, agrees only the upper bound is optional. On Thu, Jul 24, 2014 at 1:42 PM, D

Re: [GENERAL] Regular expression question with Postgres

2014-07-24 Thread David G Johnston
Mike Christensen-2 wrote > I'm curious why this query returns 0: > > SELECT 'AAA' ~ '^A{,4}$' > > Yet, this query returns 1: > > SELECT 'AAA' ~ '^A{0,4}$' > > Is this a bug with the regular expression engine? Apparently since "{,#}" is not a valid regexp expression the engine simply interprets

[GENERAL] Regular expression question with Postgres

2014-07-24 Thread Mike Christensen
I'm curious why this query returns 0: SELECT 'AAA' ~ '^A{,4}$' Yet, this query returns 1: SELECT 'AAA' ~ '^A{0,4}$' Is this a bug with the regular expression engine?