Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.6K
Visualizações
REGEX: How to allow exclusive latin characters (like accents)?

So if you ever need a regular expression to verify whether a name has been inputted correctly for instance, and you want it to allow only Latin characters and accents, here's a solution:

\^([A-Za-zÀ-ÖØ-Ý]){2,20}$\

about 4 years ago · Santiago Gelvez
3 Respostas
Responde à pergunta

0

But I owe you an explanation as to why we have À-ÖØ-Ý and not just À-Ý

Foremost, this explanation what made exclusively for beginners:

When you use [A-Z], you capture any ASCII character between A and Z : you capture a range.

If you look at the Unicode U0000 character map/ASCII Table (see below), you'll notice that it matches exactly all uppercase.

Screenshot of an ASCII Table, Unicode U0000

In the same way, you can capture the 4 last lines of the Unicode U0080: Screenshot of an ASCII Table, Unicode U0080

Though, you may realize that the multiplication (×) and division (÷) symbols are within that range.

Which is a problem because users (especially mobile users) could bypass the "only Latin letters" rule.

So to fix this issue we need to create 2 range of characters excluding these 2 characters.

Hence, why the À-ÖØ-Ýfor uppercase letters with accents and à-öø-ÿ for lowercase letters with accents.

I hope this will be useful to some people!

If you have any questions don't hesitate to ask them!

Sources:

https://fr.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange

https://fr.wikipedia.org/wiki/Table_des_caract%C3%A8res_Unicode/U0080

about 4 years ago · Santiago Gelvez Relatório

0

Saul Orozco Alvarez

about 3 years ago · Saul Orozco Relatório

0

Saul Orozco Alvarez

about 3 years ago · Saul Orozco Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda