很多时候,问题(特别是标记正则表达式的问题)会询问验证密码的方法.用户通常会寻求密码验证方法,包括确保密码包含特定字符,匹配特定模式和/或遵守最小字符数.这篇文章旨在帮助用户找到适当的密码验证方法,而不会大大降低安全性.
所以问题是:如何正确验证密码?
任何人都可以帮我提供密码的正则表达式,请使用以下内容.
包括以下至少两项:
小写字母
大写字母
数字
a'特殊字符'(例如£,$,&,#)
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js">
</script>
</head>
<body >
<div id="divi" height="100">
<form class="form-inline" role="form">
<div class="form-group" >
<label class="sr-only" for="em">Email:</label>
<input type="email" id="em" placeholder="Enter email" required >
</div>
<div class="form-group" >
<label class="sr-only" for="pwd">Password:</label>
<input type="password" id="pwd" placeholder="Enter password" required>
</div>
<button type="button" class="btn btn-primary">Login</button>
</form>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
嗨,请帮我用电子邮件 ID 验证用户 ID,密码应包含大写小写字母和至少一个字符?
我必须对密码进行 jQuery 表单验证。
密码应至少包含两个以任意顺序排列的特殊字符。我曾尝试使用 正则表达式进行密码验证,但它没有解决两个随机特殊字符可以按任何顺序出现的问题。
我如何使用 JavaScript 正则表达式来做到这一点?