snipt

Ctrl+h for KB shortcuts

JavaScript

Validar Email

1
2
3
4
function validaEmail($email){
  var filter=/^[email protected]+\..{2,3}$/;
  return (filter.test($email));
}
https://snipt.net/embed/9aed73ca95ab60d14c985e9aafe4ba51/
/raw/9aed73ca95ab60d14c985e9aafe4ba51/
9aed73ca95ab60d14c985e9aafe4ba51
js
JavaScript
4
2019-07-11T06:28:32
True
False
False
/api/public/snipt/2884/
validar-email
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">function</span> <span class="nx">validaEmail</span><span class="p">(</span><span class="nx">$email</span><span class="p">){</span> </span><span id="L-2"><a name="L-2"></a> <span class="kd">var</span> <span class="nx">filter</span><span class="o">=</span><span class="sr">/^[email protected]+\..{2,3}$/</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="p">(</span><span class="nx">filter</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">$email</span><span class="p">));</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
email, regex, validate