Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
JavaScript Email Address validation using Regular Expression

JavaScript Email Address validation using Regular Expression

22 Sep 2025
Intermediate
150K Views
2 min read
Learn with an interactive course and practical hands-on labs

Free Javascript Course Online

We can validate email address at client side and server side. To validate email address on client side, we can use java script with regular expression. Java script can check the regular expression pattern for valid email address. We have different regular expression patterns for validating email address.

In this article, I am sharing some useful cross browsers regular expression patterns for validating email address with java script and jquery. To dive deeper into JavaScript and enhance your skills, be sure to enroll in our Free Javascript Course for a complete learning experience.

Simple regular expression to validate email address

Below is simple regular expression to validate an email address. It will accept email address in upper case also.

 <script type="text/javascript">
function validateEmail(email)
{
 var reg = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
 if (reg.test(email)){
 return true; }
 else{
 return false;
 }
} 
</script> 

Read More: Javascript Developer Salary in India

Regular expression to validate case-sensitive email address

Below is regular expression to validate an email address with lower case chars.

 <script type="text/javascript">
function validateCaseSensitiveEmail(email) 
{ 
 var reg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
 if (reg.test(email)){
 return true; 
}
 else{
 return false;
 } 
} 
</script> 

Regular expression to validate free/domain specific email address

Below is regular expression to validate domain specific email address.

 <script type="text/javascript">
function validateFreeEmail(email) 
{
 var reg = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/
 if (reg.test(email)){
 return true;
 }
 else{
 return false;
 }
} 
</script> 

JQuery - Email address validation with example

 <html>
<head>
<script type="text/javascript">
$(document).ready(function(e){
 $('#btnSubmit').click(function(){ 
 var email = $('#txtEmail').val();
 if ($.trim(email).length == 0) {
 alert('Please Enter Valid Email Address');
 return false;
 }
 if (validateEmail(email)) {
 alert('Valid Email Address');
 return false;
 }
 else {
 alert('Invalid Email Address');
 return false;
 }});
});
</script>
</head> <body>
Email Address: <input type="text" id="txtEmail"/><br/>
<input type="submit" id="btnSubmit" Value="Submit" />
</body>
</html> 
Conclusion

Validating email addresses using JavaScript and regular expressions is an efficient way to ensure that user input follows a proper format before processing it. Regular expressions allow developers to quickly check patterns, reduce errors, and enhance form reliability.

React.js experts are landing ₹20–30 LPA roles while others struggle. Upgrade your skills with our React JS Online Training and secure your future.

Take our Javascript skill challenge to evaluate yourself!

In less than 5 minutes, with our skill challenge, you can identify your knowledge gaps and strengths in a given skill.

GET FREE CHALLENGE

Share Article
About Author
Shailendra Chauhan (Microsoft MVP, Founder & CEO at ScholarHat)

He is a renowned Speaker, Solution Architect, Mentor, and 10-time Microsoft MVP (2016–2025). With expertise in AI/ML, GenAI, System Design, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development, he bridges traditional frameworks with next-gen innovations.

He has trained 1 Lakh+ professionals across the globe, authored 45+ bestselling eBooks and 1000+ technical articles, and mentored 20+ free courses. As a corporate trainer for leading MNCs like IBM, Cognizant, and Dell, Shailendra continues to deliver world-class learning experiences through technology & AI.
Live Training - Book Free Demo
Advanced Full-Stack Java Developer Certification Training Course
01 Nov
05:30PM - 07:30PM IST
Checkmark Icon
Get Job-Ready
Certification
Angular Certification Training
01 Nov
07:00AM - 09:00AM IST
Checkmark Icon
Get Job-Ready
Certification
Azure AI & Gen AI Engineer Certification Training Program
02 Nov
07:00AM - 09:00AM IST
Checkmark Icon
Get Job-Ready
Certification
Azure AI Engineer Certification Training
02 Nov
07:00AM - 09:00AM IST
Checkmark Icon
Get Job-Ready
Certification
Azure Developer Certification Training
04 Nov
08:30PM - 10:30PM IST
Checkmark Icon
Get Job-Ready
Certification