Quantcast
Channel: Why doesn't a non-greedy quantifier sometimes work in Oracle regex? - Stack Overflow
Viewing all articles
Browse latest Browse all 10

Why non-greedy quantifier sometimes doesn't work in Oracle regex?

$
0
0

IMO, this query should return A=1,B=2,

SELECT regexp_substr('A=1,B=2,C=3,', '.*B=.*?,') as A_and_B FROM dual

But it returns whole string A=1,B=2,C=3, instead. Why?

UPD: Oracle 10.2+ required to use Perl-style metacharacters in regular expressions.

UPD2:
More clear form of my question (to avoid questions about Oracle version and availability of Perl-style regex extension):
Why ON THE SAME SYSTEM non-greedy quantifier sometimes works as expected and sometimes doesn't?

This works correctly:

regexp_substr('A=1,B=2,C=3,', 'B=.*?,')

This doesn't work:

regexp_substr('A=1,B=2,C=3,', '.*B=.*?,')

fiddle

UPD3:
Yes, it seems to be a bug.
Can anyone provide Oracle Support reaction on this issue?
Is the bug already known?
Does it have an ID?


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>