Could anyone (with extensive experience in regular-expression matching) please clarify for me why the following query returns (what I consider) unexpected results in Oracle 12?
select regexp_substr('My email: test@tes6t.test', '[^@:space:]+@[^@:space:]+')
from dual;
Expected result: test@tes6t.test
Actual result: t@t
Another example:
select regexp_substr('Beneficiary email: super+test.media.beneficiary1@gmail.com', '[^@:space:]+@[^@:space:]+')
from dual;
Expected result: super+test.media.beneficiary1@gmail.com
Actual result: ry1@gm
EDIT: I double-checked and this is not related to Oracle SQL, but the same behaviour applies to any regex engine. Even when simplifying the regex to [^:space:]+@[^:space:]+ the results are the same. I am curious to know why it does not match all the non-whitespace characters before and after the @ sign. And why sometimes it matches 1 character, other times 2 or 3 or more characters, but not all.