Unexpected output from REGEXP_SUBSTR
I have two strings:
RP.MOC.00012B.SM.01
123-456-7890
I am running following SQL statements:
SELECT REGEXP_SUBSTR('RP.MOC.00012B.SM.01', '.[^.]+') "REGEXP_SUBSTR" FROM dual;
SELECT REGEXP_SUBSTR('123-456-7890', '-[^-]+') "REGEXP_SUBSTR" FROM DUAL;
Output of 1st query is RP and output of 2nd query is -456
As per guide and my understanding output of 1st query should be .MOC however if I replace . with - in 1st query, -MOC is appearing but with . output is RP
I want to know what is the reason for this different behaviour of query.