RE: question about regexp_substr

  • From: Jackie Brock <J.Brock@xxxxxxxxxxxxx>
  • To: amonte <ax.mount@xxxxxxxxx>
  • Date: Tue, 16 Dec 2014 21:42:56 +0000

☺  Run it with various values where the three is – get the first occurrence, 
then the second, then the third, then the fourth – you’ll easily see what it’s 
doing.

From: amonte [mailto:ax.mount@xxxxxxxxx]
Sent: Tuesday, December 16, 2014 2:30 PM
To: Jackie Brock
Cc: Oracle-L Group
Subject: Re: question about regexp_substr

Hello Jackie
I know + means > 1 and * > 0 occurence. But I dont see why they give different 
results in my example.
I understand that what query is asking with * is

"find in the string any non-numeric character pattern, no matter if the there 
is character or not in the third occurence". I dont see why B satisfies such 
condition?

Thanks in advance

Alex

2014-12-16 22:23 GMT+01:00 Jackie Brock 
<J.Brock@xxxxxxxxxxxxx<mailto:J.Brock@xxxxxxxxxxxxx>>:
The plus sign indicates that it expects at least 1 digit (1 or more).  The * 
means 0 or more.

From: oracle-l-bounce@xxxxxxxxxxxxx<mailto:oracle-l-bounce@xxxxxxxxxxxxx> 
[mailto:oracle-l-bounce@xxxxxxxxxxxxx<mailto:oracle-l-bounce@xxxxxxxxxxxxx>] On 
Behalf Of amonte
Sent: Tuesday, December 16, 2014 2:07 PM
To: Oracle-L Group
Subject: question about regexp_substr

Hi people
I have some difficulty understanding applying an operator to the pattren in 
regexp_substr. Not sure if anyone can help ?
The question is, what is the difference between these two queries:

select regexp_substr('A1B2C3D4E', '[^0-9]+', 1, 3) from dual;

R
-
C

select regexp_substr('A1B2C3D4E', '[^0-9]*', 1, 3) from dual;

R
-
B
Why * and + gives different answers?
Thanks in advance

Alex

Other related posts: