I want to detect emails in text format so that I can bind to them a binding labeled mailto. I have a regex, but the code also detects emails that are already encapsulated with the anchor tag or are in the mailto tag anchor parameter.
My regex is:
([\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[az]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?)
But it detects 3 matches in the following text example:
ttt <a href='mailto: someone@example.com '> someemail@mail.com </a> abc email@email.com
I want only email@email.com match the regular expression.
source share