我的要求是:
我的正则表达式是:
^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*]).{8,15}$
它接受除$
,*
,^
以外的所有字符。
= f.password_field: password, placeholder: "Password",:required=>'true',:class => "form-control password_text form-control",pattern:",:title=>'Min 8letters, one uppercase, lowercase letter, onedigit, one specialcharacter',:onchange => "form.confirm_pwd.pattern = this.value;"
= f.password_field: password_confirmation, placeholder: "Password",:class => "form-control form-control password_text",:required=>'true',title:"Please enter the same Password as above",:name=>'confirm_pwd'
当我加入$
并提交,*
和^
时,它会在确认密码字段中显示“输入与上面相同的密码”。如果我包含#
或其他特殊字符,那么它就能正常运作。
答案 0 :(得分:0)
:onchange => "form.confirm_pwd.pattern =~ this.value;"