Hi,
My specific issue is alrady solved.
For the greater good I sent the email requesting to allow reg exp in the position functions.
Not sure if you will implement it... Just wanted to let you know that the limited capabilities of this function create overhead.

ב אוג׳ 20, 2018 14:35, Geoff Winkless כתב:
On Mon, 20 Aug 2018 at 09:22, Nick Dro <postgre...@walla.co.il> wrote:

This incorrect.
SELECT position(substring('https://www.webexample.com/s/help?' FROM '/(s|b|t)/') IN 'https://www.webexample.com/s/help?');
 
Gives 5. It's wrong.



On Mon, 20 Aug 2018 at 09:22, Nick Dro <postgre...@walla.co.il> wrote:

This incorrect.
SELECT position(substring('https://www.webexample.com/s/help?' FROM '/(s|b|t)/') IN 'https://www.webexample.com/s/help?');
 
Gives 5. It's wrong.

For some reason, substring() returns the parenthesised subexpression rather than the top level..

The comment in testregexsubstr does say that it does this, but it's not clear from the documentation at all, unless I'm missing where it says it.

You can work around this by putting parentheses around the whole _expression_, because that way the first subexpression is the whole match.

db=# SELECT position(substring('https://www.webexample.com/s/help?' FROM '(/(s|b|t)/)') IN 'https://www.webexample.com/s/help?');
 position
----------
       27

Geoff


Reply via email to