I am trying to validate password using regex .my condition is that Password should have
- One special character
- One number
- One lower case
- One upper case
- minimum 8 characters
Below is my code snippet
var a = "Test@123"
if (/^(?=.[a-z])(?=.[A-Z])(?=.\d)(?=.[@$!%?&])[A-Za-z\d@$!%?&]{8,}$/.test(a)) {
console.log('=====true')
} else {
console.log('false')
}
it should show true
on console. but currently it is showing false
why ?