{"id":7186,"date":"2014-05-27T09:05:21","date_gmt":"2014-05-27T09:05:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/prestashop-smarty-email-regular-expression-validation-collection-of-common-programming-errors\/"},"modified":"2014-05-27T09:05:21","modified_gmt":"2014-05-27T09:05:21","slug":"prestashop-smarty-email-regular-expression-validation-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/prestashop-smarty-email-regular-expression-validation-collection-of-common-programming-errors\/","title":{"rendered":"Prestashop Smarty email regular expression validation-Collection of common programming errors"},"content":{"rendered":"<p>I have a form, and when I submit it, I want to make an email validation before. I created a js file, put in theme&#8217;s js directory, included it on the page and my page is WHITE. I activated the errors and I saw that this is the error:<\/p>\n<blockquote>\n<p>SmartyCompilerException: Syntax Error in template &#8220;D:\\Projects\\mpm_shop\\themes\\pmart\\js\\processContactFormEmail.js&#8221; on line 44 &#8220;var re = \/^([a-zA-Z0-9_.-+])+\\@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$\/;&#8221; &#8211; Unexpected &#8220;,&#8221;, expected one of: &#8220;}&#8221; , &#8221; &#8221; , ATTR in D:\\Projects\\mpm_shop\\tools\\smarty\\sysplugins\\smarty_internal_templatecompilerbase.php on line 667<\/p>\n<\/blockquote>\n<p>My regex is this one:<\/p>\n<blockquote>\n<p>var re = \/^([a-zA-Z0-9_.-+])+\\@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$\/;<\/p>\n<\/blockquote>\n<p>and I try to match it like this:<\/p>\n<pre><code>if (!email.match(re)) {\n                    $('#email').css('border', '1px solid red'); \n                    $('.errorEmail').html('Email non \u00e8 valido');\n                    valid = false;\n                }\n<\/code><\/pre>\n<p>Please help.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a form, and when I submit it, I want to make an email validation before. I created a js file, put in theme&#8217;s js directory, included it on the page and my page is WHITE. I activated the errors and I saw that this is the error: SmartyCompilerException: Syntax Error in template &#8220;D:\\Projects\\mpm_shop\\themes\\pmart\\js\\processContactFormEmail.js&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7186","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7186"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7186\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}