Skip to content

Instantly share code, notes, and snippets.

View monikaja's full-sized avatar

Mónica monikaja

View GitHub Profile
@monikaja
monikaja / ValidateSpanishID.ts
Created February 24, 2018 13:43 — forked from afgomez/validate_spanish_id.js
Spanish DNI, CIF, NIE validator
const DNI_REGEX = /^(\d{8})([A-Z])$/;
const CIF_REGEX = /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/;
const NIE_REGEX = /^[XYZ]\d{7,8}[A-Z]$/;
export class ValidateSpanishID {
public static validateID(str:string) {
if(!str){
return null;