How to create regex that accepts only characters with no accents

0

In my form html , I have the "name" field. In this field, I want to allow the field to accept only characters with no accents. How to do this validation using Regex?

I do not want a function, I want to put an attribute type in the field that blocks accents.

    
asked by anonymous 22.05.2018 / 15:18

2 answers

2

You can use the pattern attribute of input , using the regex [A-Za-z ]* ...

<form action="...">

  <input name="username" id="username" type="text" pattern="[A-Za-z ]*" title="Somente letras sem acento">

  <input type="submit">
</form>
    
22.05.2018 / 16:32
0

I created a regex as follows:

/[a-zA-Z ]/
    
22.05.2018 / 16:17