LoginSignup
21
18

More than 5 years have passed since last update.

【正規表現】半角英字と数字をどちらも含む8文字以上の半角英数の正規表現

Posted at

パスワードによく使用される半角英字と半角数字の組み合わせを含む8文字以上の正規表現を考えた際のメモ。
例: hoge1234とか1234Hogeとか

実装した正規表現パターン

/^(?=.*?[a-zA-Z])(?=.*?\d)[a-zA-Z\d]{8,}$/

こちらのサイトで可視化した結果が以下になります。
image-2.png

一応できていそうですね。

もっと効率の良かったり、こうしたほうがいいみたいな意見がございましたら教えていただけると嬉しいです。

21
18
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
18