Regex for Brazilian surnames

Hello everyone,

regex(., ‘^([A-Z]{1}[a-z]{1,}\s)([A-Z]{1}[a-z]{1,}\s?)+$’)

This expression restrict an input of the beneficiaries’ full name where the initials of the names are in uppercase and the name are quite long (often greater than 3 words).

I need this expression to keep in lowercase those words with up to three letters.

E.g.

  • João da Silva Nascimento
  • Maria das Dores
  • Pedro Silva de Oliveira

Any suggestion please. Thanks in advance.

@Sanabria, you will first need to identify the order of the name that has to come as a lower letter. Or, for your ease maybe you could create a regex that should accept both the upper case and the lower case.