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 doesn't a non-greedy quantifier sometimes 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 the whole string, A=1,B=2,C=3,, instead. Why?


Update 1:

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

Update 2:

A more clear form of my question (to avoid questions about Oracle version and availability of Perl-style regex extension):

On the same system, why does a non-greedy quantifier sometimes work as expected and sometimes not?

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

Update 3:

Yes, it seems to be a bug.

What is the 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