Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results - Mailing list pgsql-general

From Denis Papathanasiou
Subject Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results
Date
Msg-id 50D47F46.7060401@banrai.com
Whole thread Raw
In response to Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results  ("David Johnston" <polobo@yahoo.com>)
Responses Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results  ("David Johnston" <polobo@yahoo.com>)
Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi David,

On 12/20/2012 08:48 PM, David Johnston wrote:
>> -----Original Message-----
>> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
>> owner@postgresql.org] On Behalf Of Denis Papathanasiou
>> Sent: Thursday, December 20, 2012 7:56 PM
>> To: pgsql-general@postgresql.org
>> Subject: [GENERAL] Using POSIX Regular Expressions on xml type fields
> gives
>> inconsistent results
[snip]
> [At this point I'd confirm or question why ANY hasn't been made to go both
> ways but also realize that I will have to approach this in a different way
> to achieve my goal.]

I did realize that ANY() must be a right-hand operator, but what I
didn't understand (and admittedly still don't understand) is why regex
operations that are normally right-side work from the left.

If you look at the four examples which follow the posix match table in
the docs
(http://www.postgresql.org/docs/9.1/static/functions-matching.html#FUNCTIONS-POSIX-TABLE),
some of them work from the left side, e.g.:

'abc' ~ '(b|d)'  true

In my original example, I found I could write this from left to right
like this, and it would still work:

'(b|d)' ~ 'abc'  true

But when I reverse this expression:

'abc' ~ '^a'     true

like this, it doesn't work:

'^a' ~ 'abc'     false




pgsql-general by date:

Previous
From: "jg"
Date:
Subject: Coalesce bug ?
Next
From: "David Johnston"
Date:
Subject: Re: Coalesce bug ?