Strong Password Regex
Matches passwords with at least 8 chars, uppercase, lowercase, number, and special character.
passwordsecurityvalidation
正規表現パターン
/^(?=.*[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)使い方
- 上記のパターンをコピーしてください
- 「ビジュアライザーで動作確認」ボタンをクリックすると、実際のマッチ結果を確認できます
- コード例をそのままプロジェクトに貼り付けて使用できます
注意事項
- このパターンはJavaScriptの正規表現エンジンで動作確認しています
- 言語によって動作が異なる場合があります。必ずビジュアライザーでテストしてください
- 本番環境での使用前に十分なテストを行ってください