Quantcast
Channel: How can I validate an email address using a regular expression? - Stack Overflow
Viewing all articles
Browse latest Browse all 89

Answer by user2467899 for How can I validate an email address using a regular expression?

$
0
0

In order to validate an email address with JavaScript it is more convenient and efficient use this function (according with w3school):

function validateEmail(){var x=document.f.email.value;var atpos=x.indexOf("@");var dotpos=x.lastIndexOf(".");if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)  {  alert("Not a valid e-mail address");  return false;  }}

I use it and it's perfect. I hope to be useful.


Viewing all articles
Browse latest Browse all 89

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>