I have a textarea
where users can enter or paste email addresses of other people and send them an invite after pressing Submit button. Each email must be seperated with a comma and valid before the form is submitted - validation is taken care of by jQuery Validate plugin & multiemail method.
Problem
Some people paste email addresses directly from their email clients and those emails are often in a weird format - containing name and surname before the actual email, or the email is wrapped in < >. For example:
"The Dude" <the.dude@gmail.com>, "The Dudette" <thedudette193@gmail.com>
Question
What I want to do is to Extract all email addresses from bulk text using jquery, but I'm having problems integrating this piece of code to work with my textarea
- I don't know where to start.
How could I use the code from the above answer to extract each email entered into the textarea
after a comma is typed or when the focus is moved away from textarea
? So if I paste "The Dude" <the.dude@gmail.com>
and type ,
after it or switch focus away, the entered value would change to the.dude@gmail.com
.