sql - REGEXP_REPLACE to replace emails in a list except a specific domain -
i novice regular expressions. trying remove emails list not belong specific domain.
for e.g. have below list of emails:
john@yahoo.co.in , jacob@gmail.com, bob@rediff.com, lisa@abc.com, sam@gmail.com , rita@yahoo.com
i need gmail ids:
jacob@gmail.com, sam@gmail.com
please note may have spaces before comma delimiters. appreciate help!
this start you.
select * ( select regexp_substr (str, '[[:alnum:]\.\+]+@gmail.com', 1, level) substr (select ' john@yahoo.co.in , jacob.foo@gmail.com, bob@rediff.com,lisa@abc.com, sam@gmail.com , sam.bar+stackoverflow@gmail.com, rita@yahoo.com, foobar ' str dual) connect level <= length (regexp_replace (str, '[^,]+')) + 1) substr not null ;
put in few more examples, email checker should comply respective rfcs, @ wikipedia further knowledge them https://en.wikipedia.org/wiki/email_address
inspiration https://stackoverflow.com/a/17597049/869069
Comments
Post a Comment