我正在编写jquery验证来制作一个强密码。我写了特殊字符的条件,它不起作用。我正在尝试如下。
"regex": /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$])[0-9a-zA-Z]{8,}$/,
"alertText": "*Password should contain atleast one special character,one number and one upper case letter",
我遇到(?=.*[!@#$])
部分代码时遇到问题。如果我删除此正则表达式将起作用,但它不会验证特殊字符。如果我放(?=.*[!@#$])
什么都不会验证。我总是收到错误弹出窗口。我不确定(?=.*[!@#$])
这一部分。
答案 0 :(得分:3)
模式末尾的消费角色类( I think you are showing the content through modal "showallcomments". which is over-writing every time when you click on comment button.
I mean to say you are binding same variable in all comment boxes.
<div class="col-lg-12" ng-repeat="dat in details | orderBy : sortColumn : reverseSort | filter : { product_name : textname} as results">
<ul>
<li><b>Product:</b><span> {{dat.product_name}}</span></li>
<li><b>Product Manager:</b><span> {{dat.first_name}} {{dat.last_name}}</span></li>
<li><b>Status:</b><span> {{dat.status}}</span></li>
<li><b>Description:</b><span> {{dat.description}}</span></li>
</ul>
<!--Comment Button -->
<button style="background-color:#4C97C8;color:white;height:30px" class="btn" ng-click="showCommentBox($index);$parent.showcomments(dat.id)">
<span class="glyphicon glyphicon-comment"></span><strong> Comment</strong></button>
<!--Comment Box -->
<div ng-show="dat.showComment">
<div class="detailBox col-lg-12">
<div class="titleBox">
<label>Comment Box</label>
<button type="button" class="close" aria-hidden="true" ng-click="comment=false">×</button>
</div>
<div class="actionBox">
<ul class="commentList">
<li ng-repeat="sh in showallcomments">
<div class="commenterImage">
<img src="" />
</div>
<div class="commentText">
<p class="">{{sh.comment}}</p> <span class="date sub-text">{{sh.date_created}}</span>
</div>
</li>
</ul>
<div class="input-group ">
<input type="text" id="commentarea" name="commentarea" class="form-control" placeholder="Your Comments" aria-describedby="basic-addon2" ng-model="takecomment">
<span class="input-group-addon" id="basic-addon2" ng-click="takecomment=mycomment(dat.id,takecomment)"><span class="glyphicon glyphicon-send"></span></span>
</div>
</div>
</div>
</div>
</div>
showCommentBox = function(index){
angular.forEach('details', function(value, key){
if(key == index){
value.showComment = true;
}else{
value.showComment = false;
}
})
}
)与[0-9a-zA-Z]
前瞻所需的特殊字符不匹配。在那里添加(?=.*[!@#$])
个字符:
!@#$