9.5.3: substring: regex greedy operator not picking up chars as expected - Mailing list pgsql-bugs

From Foster, Russell
Subject 9.5.3: substring: regex greedy operator not picking up chars as expected
Date
Msg-id BLUPR0401MB169851229377B5C9780EAC6B9D120@BLUPR0401MB1698.namprd04.prod.outlook.com
Whole thread Raw
Responses Re: 9.5.3: substring: regex greedy operator not picking up chars as expected
Re: 9.5.3: substring: regex greedy operator not picking up chars as expected
List 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 t=
he expected result on https://regex101.com/, although I am aware not all re=
gex 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 t=
he left (.*?) be affecting the more greedy right one (+)?

Thanks,
Russell Foster

pgsql-bugs by date:

Previous
From: Devrim Gündüz
Date:
Subject: Re: BUG #14288: sd_notify not called on startup using rhel RPMs
Next
From:
Date:
Subject: Re: BUG #14288: sd_notify not called on startup using rhel RPMs