Re: BUG #16826: Regex in substring(... from ..) wrong

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "james(dot)inform(at)pharmapp(dot)de" <james(dot)inform(at)pharmapp(dot)de>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16826: Regex in substring(... from ..) wrong
Date: 2021-01-15 14:20:22
Message-ID: CAKFQuwbsP=k5Po-=sUAJ_BQ_eQBZh9BbURtoKkm7HMiG8oBfBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Friday, January 15, 2021, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 16826
> Logged by: James Inform
> Email address: james(dot)inform(at)pharmapp(dot)de
> PostgreSQL version: 13.1
> Operating system: Mac and Ubuntu
> Description:
>
> Hopefully I am not messing up regex syntax, but it seems that handling of
> non-greedy is not correct in substring function's regex.
>
> When I set the non-greedy operator ? inside a regex in the substring
> function, everything after the ? seems to be also treated as non-greedy,
> which is wrong.
>

This seems to behave per the documentation in 9.7.3.5

https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP

Implementations of regex do differ so referencing prior experience for
correctness has limits.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Springl 2021-01-15 19:54:10 syntactically correct query gives ERROR: failed to assign all NestLoopParams to plan nodes
Previous Message PG Bug reporting form 2021-01-15 14:00:03 BUG #16827: macOS interrupted syscall leads to a crash