Email validation via pattern

0

I would like to set the pattern for a field to always validate emails typed in the format: [email protected]

@Html.TextBoxFor(m => m.UsuarioEmail, 
new { 
      @class = "form-control", 
      id = "UsuarioEmail", 
      placeholder = "Endereço de E-mail (@minhaempresa.com.br)" , 
      ng_pattern = @"^/[a-z0-9._%+-][email protected]$/" 
})

I'm using the above pattern, but it's not working. How do I?

    
asked by anonymous 26.08.2016 / 17:16

1 answer

0

Resolved.

I changed ng_pattern to just pattern .

The expression pattern became:

pattern = @"^/[a-z0-9.]+[a-z0-9]@minhaempresa.com.br$/"
    
26.08.2016 / 17:24