javascript - Strip contact information from email -


i have users enter emails like:

john smith <john@example.org>

i have regex /(.+[ <>])/g not correct this.

i have output like:

john@example.org

i want email component, , want ignore else user may give.

edit: people getting confused. want input turn out output. has nothing validation. have validation. has cleaning input before gets validation.

assuming e-mail input has "@" symbol, can select single token e-mail makes symbols you'd accept. example:

[a-za-z0-9.]*?@[a-za-z0-9.]*

test test test john smith@hotmail.com test 

will result in

smith@hotmail.com 

e-mails can contain dashes , underscores (john-smith@hotmail.com), consider adding them [a-za-z0-9.] character class, making [a-za-z0-9.\-_], or whatever characters feel appropriate.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -