Javascript examples for RegExp:Match Email
Use regex to validate email address
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//from www .j ava 2 s . c o m var myString="aaa@aaa.com"; var mailValidator = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; if (!mailValidator.test(myString)) { console.log("incorrect"); } }); </script> </head> <body> </body> </html>