Why is validation not working? What would be the regular expression?

0
<input id="iniciarsesionnombre" placeholder="Usuario" pattern="/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/" required type="text" class="validate white-text">
           <script>
              $('#iniciarsesionnombre').keypress(function(e){
                   var regex = new RegExp("/^[a-z0-9_.+-]+\@(?:[a-z0-9-]+\.)+[a-z0-9]{2,63}$/i");
                   var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
                     if (regex.test(str)) {
                          return true;
                         }
                      e.preventDefault();
                    return false;
              });
              $(document).ready(function(){
                $("#iniciarsesionnombre").on('paste', function(e){
                  e.preventDefault();
                });
            });   
          </script>
    
asked by cccc 25.10.2018 в 02:03
source

0 answers