SELECT CHR(91)||'a-zA-Z0-9._%-'||CHR(93)||'+'|| listagg(REGEXP_SUBSTR('[email protected], [email protected]', '@'||CHR(91)||'^,'||CHR(93)||'+', 1, LEVEL), ', ') within group (order by level) as domain
FROM DUAL
CONNECT BY REGEXP_SUBSTR('[email protected], [email protected]','@'||CHR(91)||'^,'||CHR(93)||'+', 1, LEVEL) IS NOT NULL
order by 1;
Above script only has the regular expression in front of @yahoo.com
[a-zA-Z0-9._%-][email protected], @hotmail.com
Expected result:
[a-zA-Z0-9._%-][email protected], [a-zA-Z0-9._%-][email protected]