6

I have this regexp that matches correctly everything I need (all the email addresses NOT inside a link):

/((?<!mailto:|=|[a-zA-Z0-9._%+-])[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.‌​-]+\.[a-zA-Z]{2,64}(?![a-zA-Z]|<\/[aA]>))/

Unfortunately, since javascript does not support lookbehind, it does not work on my web app. Is there a solution for that?

1 Answer 1

3

By definition, you have to look behind to know there is no starting link tag <a> before the email address.

You can try:

  1. match each email address, and then verify that the email address is not inside a link programmatically

or

  1. use AJAX send the data to your server, and get your server to do the Regex.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.