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

Answer by exussum for Why doesn't a non-greedy quantifier sometimes work in...

Because you're selecting too much:SELECT regexp_substr('A=1,B=2,C=3,','.*?B=.*?,' ) as A_and_B, -- Now works as expected regexp_substr('A=1,B=2,C=3,','B=.*?,' ) as B_only -- works just fineFROM dualSQL...

View Article



Answer by Andrew Wolfe for Why doesn't a non-greedy quantifier sometimes work...

You've got a really great bounty, so I'm going to try to nail it comprehensively.You make assumptions in your regular expression handling that are incorrect.Oracle is NOT compatible with Perl regular...

View Article

Answer by tbone for Why doesn't a non-greedy quantifier sometimes work in...

Looking at the feedback, I hesitate to jump in, but here I go ;-)According to the Oracle docs, the *? and +? match a "preceding subexpression". For *? specifically:Matches zero or more occurrences of...

View Article

Answer by Old Pro for Why doesn't a non-greedy quantifier sometimes work in...

It's a BUG!You are right that in Perl, 'A=1,B=2,C=3,' =~ /.*B=.*?,/; print $& prints A=1,B=2,What you have stumbled upon is a bug that still exists in Oracle Database 11g R2. If the exact same...

View Article

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

IMO, this query should return A=1,B=2,SELECT regexp_substr('A=1,B=2,C=3,', '.*B=.*?,') as A_and_B FROM dualBut it returns the whole string, A=1,B=2,C=3,, instead. Why?Update 1:Oracle 10.2+ is required...

View Article

Browsing latest articles
Browse All 10 View Live




Latest Images