Validate DNI (Spanish identity document)
The following regular expression can be used to validate that users input a valid DNI value with the structure of 8 numbers + 1 letter (example: 12345678R):
^(\d{8}[a-zA-Z]{1})$
The following regular expression can be used to validate a DNI and NIE as well:
^(0|1|2|3)[0-9]{12}$
Iniciar sesión para dejar un comentario.