Re: Force ARE in regexp string

Lists: pgsql-general
From: Johannes Öberg <johannes(dot)oberg(at)proactivegaming(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Force ARE in regexp string
Date: 2010-09-15 09:20:14
Message-ID: 4C908FCE.2080109@proactivegaming.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi! I'm trying to do an advanced regexp match but postgres doesn't
seem to let me.

I've set regex_flavor to ARE, and I've tried prefixing my strings, i.e.
~* E'***:abc' but for some reason postgres treats all my regexps as BRE's.

Common newbie gotchas? I'm trying it directly from psql.exe btw, running
postgres 8.4 on a professionally set up Linux machine, and I've also
tried it locally on a Windows Bitnami machine with the same results.

Thank
/J


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Johannes Öberg <johannes(dot)oberg(at)proactivegaming(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Force ARE in regexp string
Date: 2010-09-15 13:33:00
Message-ID: 3954.1284557580@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

=?ISO-8859-1?Q?Johannes_=D6berg?= <johannes(dot)oberg(at)proactivegaming(dot)com> writes:
> Hi! I'm trying to do an advanced regexp match but postgres doesn't
> seem to let me.

> I've set regex_flavor to ARE, and I've tried prefixing my strings, i.e.
> ~* E'***:abc' but for some reason postgres treats all my regexps as BRE's.

> Common newbie gotchas?

Well, the symptom as described seems pretty improbable. You didn't show
an exact example, but I'm suspecting the real problem is that you're not
allowing for backslashes in a string literal getting eaten by string
parsing. Do the cases that don't work for you involve backslashes in
the regex?

regards, tom lane


From: Johannes Öberg <johannes(dot)oberg(at)proactivegaming(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Force ARE in regexp string
Date: 2010-09-22 16:42:45
Message-ID: 4C9A3205.9020409@proactivegaming.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 2010-09-15 15:33, Tom Lane wrote:
> =?ISO-8859-1?Q?Johannes_=D6berg?=<johannes(dot)oberg(at)proactivegaming(dot)com> writes:
>> I've set regex_flavor to ARE, and I've tried prefixing my strings, i.e.
>> ~* E'***:abc' but for some reason postgres treats all my regexps as BRE's.
> Well, the symptom as described seems pretty improbable. You didn't show
> an exact example, but I'm suspecting the real problem is that you're not
> allowing for backslashes in a string literal getting eaten by string
> parsing. Do the cases that don't work for you involve backslashes in
> the regex?
>
> regards, tom lane
>
This was indeed what was happening, problem solved, thanks alot! Now,
I'm having new problems with Postgres seemingly thinking I'm regexping
too much for a single query, but that's will be another thread.