码迷,mamicode.com
首页 > 其他好文 > 详细

Regex Password Validation

时间:2017-01-26 13:17:40      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:ida   turn   write   pre   contains   nbsp   ber   char   test   

You need to write regex that will validate a password to make sure it meets the follwing criteria:

  • At least six characters long
  • contains a lowercase letter
  • contains an uppercase letter
  • contains a number
    function validate(password) {
      return /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{6,}$/.test(password);
    }

     

Regex Password Validation

标签:ida   turn   write   pre   contains   nbsp   ber   char   test   

原文地址:http://www.cnblogs.com/bldf/p/6351509.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!