9.5.3: substring: regex greedy operator not picking up chars as expected

From: "Foster, Russell" <Russell(dot)Foster(at)crl(dot)com>
To: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: 9.5.3: substring: regex greedy operator not picking up chars as expected
Date: 2016-08-15 11:53:29
Message-ID: BLUPR0401MB169851229377B5C9780EAC6B9D120@BLUPR0401MB1698.namprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello,

For the following query:

select substring('>772' from '.*?[0-9]+')

I would expect the output to be '>772', but it is '>7'. You can also see the expected result on https://regex101.com/, although I am aware not all regex processors work the same.

The following queries:

select substring('>772' from '^.*?[0-9]+$')

and:

select substring('>772' from '[0-9]+')

both return '>772', which is expected. Could the less greedy operator on the left (.*?) be affecting the more greedy right one (+)?

Thanks,
Russell Foster

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message boris.djurdjevic 2016-08-15 12:20:56 Re: BUG #14288: sd_notify not called on startup using rhel RPMs
Previous Message Devrim Gündüz 2016-08-15 11:37:14 Re: BUG #14288: sd_notify not called on startup using rhel RPMs