Regular expression | Password input check


Regular expressions are used to check that the password string satisfies all of the following.


・Character string of 12 characters or more

・Includes all half-width uppercase letters, lowercase letters, numbers, and symbols

・Do not include consecutive character strings of 5 or more characters


*Here, the symbols that can be used are as follows.

!-/:-@\[-`\{-~


Regular expression for password checking

Use the regular expression below.

^(?=.*?[0-9])(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[!-/:-@\[-`\{-~])(?!.*?(.)\1{4,})[0-9a-zA-Z!-/:-@\[-`\{-~]{12,}$



(?=.*?[0-9])(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[!-/:-@\[-`\{-~])

This checks to ensure that all half-width uppercase letters, lowercase letters, numbers, and symbols are included.


(?!.*?(.)\1{4,})

This checks that it does not contain any consecutive strings of more than 5 characters.


[0-9a-zA-Z!-/:-@\[-`\{-~]{12,}

This checks that the string is at least 12 characters long.



スポンサーリンク

0 件のコメント :

コメントを投稿