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}$
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,}
{
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
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
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?