Strong Password Regex
Matches passwords with at least 8 chars, uppercase, lowercase, number, and special character.
パターン
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/
→ ビジュアライザーで開くテスト例
WeakPass
Str0ng@Pass
Another#Good1
tooshort1A@
コード例
javascript
const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
const isStrong = regex.test(password);python
import re
pattern = re.compile(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$')
is_strong = bool(pattern.match(password))go
import "regexp"
re := regexp.MustCompile(`^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$`)
isStrong := re.MatchString(password)passwordsecurityvalidation