Reputation: 2222
I have a input string like following
'"sadf asd " <[email protected]>'
'"[email protected] " <[email protected]>'
now i want to extract email address as following:
[email protected]
[email protected]
how can i get it ?
Upvotes: 0
Views: 29
Reputation: 1397
Here is a way:
select replace(replace(REGEXP_SUBSTR('"[email protected] " <[email protected]>','[<](\w+@(\w*.\w*)+)[>]'),'<',''),'>','')
from dual
This will return [email protected]
Upvotes: 1
Reputation: 22949
Assuming that the address is always quoted by <...>
and that there are no '<
' or '>
' in the first part of the string, you can use:
select regexp_replace('"[email protected] " <[email protected]>', '(.*)<(.*)>', '\2')
from dual
Upvotes: 1