Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug - Mailing list pgsql-bugs

From Tom Lane
Subject Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug
Date
Msg-id 32565.1557590361@sss.pgh.pa.us
Whole thread Raw
In response to Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
"Daniel Verite" <daniel@manitou-mail.org> writes:
>     Robert Schreiber wrote:
>> What appears to be happening is that the _Q? on the tail_ is being 
>> matched, but _the Q is also being included in the collected data.__

> You seem to expect that % must be non-greedy and let the final Q?
> match 1 Q instead of 0, but there doesn't appear to be anything
> in the doc  that supports this interpretation.
> In fact, it mentions that "%" is comparable to ".*" in POSIX
> regular expressions, and the latter _is_ greedy.

Right.  You could get the behavior you want using a non-greedy quantifier,
but you'd have to use the POSIX regexp functions, not substring().

            regards, tom lane



pgsql-bugs by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug
Next
From: Andrew Gierth
Date:
Subject: Re: PostgreSQL 9.3.5 substring(text from pattern for escape) bug