Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の要件の正規表現を作成します
最初の3つは簡単ですが、少なくとも特殊文字(',":*^%>?などの可能な特殊文字)を制限する方法を見つけることができませんでした。
',":*^%>?
これらは、先読みを組み合わせて解決できます。
(?=.*[a-zA-Z])
(?=.*\d)
.{8}
(?=.*[^\da-zA-Z])
最後の例では、非文字と非数字を必要とするだけです。これは、「特別な」文字が必要であることを指定する最も簡単な方法です。
だから最後にあなたが持っている
^(?=.*[a-zA-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8}$