1
I need the regular expression to accept the key c cedilla.
$('[name="txtEndereco"]').keyup(function () { this.value = this.value.replace(/[^a-zA-Z 0-9]+/g,''); });
1
I need the regular expression to accept the key c cedilla.
$('[name="txtEndereco"]').keyup(function () { this.value = this.value.replace(/[^a-zA-Z 0-9]+/g,''); });
4
/[^a-zA-ZçÇ 0-9]+/g
Working with regex in accented letters is +/- difficult in Javascript.
In other languages there is the class \p{L}
which includes all characters that are letters. In Javascript sometimes it is best to add the cases that are accurate.
1
Using [À-ã] picks up cedilla, uncle, severe accent, acute accent, circumflex accent etc. I had problems and used this expression, it worked very well.
Browser other questions tagged javascript jquery regex
You are not signed in. Login or sign up in order to post.
/[^a-zA-ZçÇ 0-9]+/g
?– Sergio
It would be something like that?
'çedilh!a'.replace(/[^A-zÀ-ÿ\s\d]/, ''); // dá çedilha
– Sergio
This way it worked''replace(/[ a-za-Zçç 0-9]+/g,')'' @Sergio.
– Almir Antonio
Mark his answer as the correct answer
– Pedro Abreu