How to create regex that only accepts characters without accents

Asked

Viewed 105 times

0

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

I don’t want a function, I want to put a kind of attribute in the field that blocks accents.

2 answers

2


You can use the attribute pattern 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>

0

I created a regex as follows:

/[a-zA-Z ]/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.