谁能帮我写一个JavaScript的正则表达式?高分!

来源:百度知道 编辑:UC知道 时间:2024/05/29 06:05:36
问题:密码非8位纯数字,为6-14位字母、数字、下划线
密码不能是八位以下的纯数字,只能为字母、数字、下划线,长度为6到14位

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
function check(){
var t=document.getElementById("dds").value;
var reg1 = /\w{6,14}/;//6-14位组合字符;
var reg2 = /\d{6,7}/;//不包含6-7位纯数字;
if(reg1.test(t) && !(reg2.test(t) && String(t).length<8)){alert("true");}else{alert("false");}//主判断句;
}
</script>
</head>