Simple regex to see if a string is a valid DNI/NIE number.
DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain.
This will only take you so far. To fully verify the DNI/NIE you will have to:
DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI)
NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.
#+ Some simple tests
# Valid NIE
# Valid, old NIE
# Valid DNI
#- Random variations and common mistakes