JavaScript Coder

regular expression validation

Javascript password validation using regular expression

Suppose you want to validate whether the password has at least one number other than alphabetic characters. Here is the regular expression to validate that condition Check at least one number exists in the password Here is the regular expression validation that confirms at least one number exists in the password function validatePassword(pwd) { var re = /^(?=.*\d).+$/ return re.test(pwd) } This regular expression makes use of (positive lookahead assertion)[https://stackoverflow.com/a/1570916/1198745] (?

Continue Reading →