Regular expression: real world example # 20

Email verification

/^[^\s@-]+@[^\s@-]+\.[^\s@-]+$/g



Password verification

let password = 'aAfsd&f5@#', length = /^.{8,32}$/, upperCase = /[A-Z]/, lowerCase = /[a-z]/, number = /[0-9]/, special = /[!"#$%&'()*+,\\.-:;<=>?@[\]^_{|}~`-]/; function passwordFind(password){ if(length.test(password) && upperCase.test(password) && lowerCase.test(password) && number.test(password) && special.test(password)) { console.log('Matched'); }else{ console.log('Not Worked'); } } passwordFind(password);

Date verification


Post a Comment

Previous Post Next Post