{"id":38,"date":"2009-11-21T09:17:00","date_gmt":"2009-11-21T09:17:00","guid":{"rendered":"http:\/\/www.codeboss.in\/web-funda\/?p=38"},"modified":"2009-11-21T09:17:00","modified_gmt":"2009-11-21T09:17:00","slug":"javascript-email-validation-with-regular-expression","status":"publish","type":"post","link":"https:\/\/codeboss.in\/web-funda\/2009\/11\/21\/javascript-email-validation-with-regular-expression\/","title":{"rendered":"Javascript Email Validation With Regular Expression"},"content":{"rendered":"<p>First lets see the code<\/p>\n<pre class=\"brush: html;\">\n<script type=\"text\/javascript\">\nfunction vaildEmail(){\nvar emailExp=\/^([a-zA-Z0-9_\\.\\-])+\\@+([a-zA-Z0-9\\-]{2,})+\\.+([a-zA-Z0-9\\.]{2,6})$\/;\nif (document.getElementById('emailId').value.search(emailExp)==-1) \/\/if match failed\nalert(\"Please enter a valid email\"); \n}\n<\/script>\n<form name=\"frm\">\n<input type=\"text\" name=\"email\" id=\"emailId\">\n<input type=\"button\" onClick=\"vaildEmail()\" value=\"check\">\n<\/form>\n<\/pre>\n<p>Now the explanation<\/p>\n<p>\/^([a-zA-Z0-9_\\.\\-])+\\@+([a-zA-Z0-9\\-]{2,})+\\.+([a-zA-Z0-9\\.]{2,6})$\/<\/p>\n<table width=100%>\n<tr>\n<td valign=\"top\"><strong>^[a-zA-Z0-9_\\.\\-]<\/strong><\/td>\n<td valign=\"top\">=<\/td>\n<td valign=\"top\">Matching the beginning of the string<br \/>Any character from a-z, A-Z, 0-9 and . &#8211; _<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>\\@<\/strong><\/td>\n<td valign=\"top\">=<\/td>\n<td valign=\"top\">@<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>[a-zA-Z0-9\\-]{2,}<\/strong><\/td>\n<td valign=\"top\">=<\/td>\n<td valign=\"top\">Any character from a-z, A-Z, 0-9 and &#8211;<br \/>Number of characters should be at least 2<br \/>There are no upper limit on number of characters<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>\\.<\/strong><\/td>\n<td valign=\"top\">=<\/td>\n<td valign=\"top\">.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>([a-zA-Z0-9\\.]{2,6})$<\/strong><\/td>\n<td valign=\"top\">=<\/td>\n<td valign=\"top\">Matching the end of the string<br \/>Any character from a-z, A-Z, 0-9 and .<br \/>Number of characters should be between 2 and 6<\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>First lets see the code Now the explanation \/^([a-zA-Z0-9_\\.\\-])+\\@+([a-zA-Z0-9\\-]{2,})+\\.+([a-zA-Z0-9\\.]{2,6})$\/ ^[a-zA-Z0-9_\\.\\-] = Matching the beginning of the stringAny character from a-z, A-Z, 0-9 and . &#8211; _ \\@ = @ [a-zA-Z0-9\\-]{2,} = Any character from a-z, A-Z, 0-9 and &#8211;Number of characters should be at least 2There are no upper limit on number of characters \\.&hellip; <a class=\"more-link\" href=\"https:\/\/codeboss.in\/web-funda\/2009\/11\/21\/javascript-email-validation-with-regular-expression\/\">Continue reading <span class=\"screen-reader-text\">Javascript Email Validation With Regular Expression<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[51,63],"class_list":["post-38","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-javascript-2","tag-regular-expression","entry"],"_links":{"self":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/38","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":0,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"wp:attachment":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}