* ऑपरेटर डिफ़ॉल्ट रूप से 'लालची' होता है
. आप distinct . के बीच किसी भी वर्ण को अनुमति दे रहे हैं और ) , किसी भी मात्रा में। और पहले ) . सहित स्वयं।
जैसा कि ईटÅपीच ने सुझाव दिया था, आप इसे ? . के साथ गैर-लालची बना सकते हैं :
तो यहाँ, .*? . के साथ .* . के बजाय :
select regexp_substr(
'select count(distinct empno), count(distinct deptno) from emp',
'count\(distinct.*?\)')
from dual;
या आप निर्दिष्ट कर सकते हैं कि यह ) . को छोड़कर कोई भी वर्ण होना चाहिए [^)]* . के साथ .* . के बजाय ।
select regexp_substr(
'select count(distinct empno), count(distinct deptno) from emp',
'count\(distinct[^)]*\)')
from dual;