I want to be able to extract an email address embedded in tags e.g. <email> test@demo.com </email>
where the src is as <email>test@demo.com</email>
My expression I use is as follows: (?<=email>).*(?=<)/i)
.
This works well. However, if the email is a hyperlink i.e. <email>**<a href="mailto:test@demo.com" target="_blank"**>test@demo.com</a> </email>
then i can no longer extract the extact email address. i get the following:
<a href="mailto:test@demo.com">test@demo.com</a>
instead of test@demo.com
. I have tried (?<=a href="mailto:).*(?="target="_blank")/i)
but nothing is returned.
Any ideas on how to extract the email when the hyperlink is there?