【发布时间】:2015-04-24 19:05:32
【问题描述】:
练习为 jQuery 类制作和使用表单。作为任务的一部分,我们得到了以下内容:
Password must follow the pattern:
- first character must be a letter
- following characters may be letters, numbers, and an underscore
- must be between 3 and 15 total characters
the password and the confirm password entries must match
You may use HTML5 input types and attributes. The following regular
expression can be used for the password: /^[a-zA-Z]\w{3,14}$/
因此,在我的页面中,我将密码标签(在表单标签内)如下所示:
<input type="text" id="password" pattern="/^[a-zA-Z]\w{3,14}$/" required>
但没有满足所列条件的密码通过。每次我点击提交时,它都会弹出一个提示“请匹配请求的格式”。我做错什么了吗?我一直在阅读正则表达式,对我来说它看起来不错(授予的正则表达式对我来说从来都不是一个强项)
【问题讨论】:
标签: jquery html regex forms validation