admin管理员组文章数量:1410682
Please see below examples which needs to be satisfied with the regular expression.
Rule : 4-12 alphanumeric characters or special characters (~!@$%&*_+) at least one letter, no spaces
test ---------This is Valid
test@2 ---------This is Valid
test2 ---------This is Valid
2222 ---------This is NOT Valid
2222@ ---------This is NOT Valid
@2222 ---------This is NOT Valid
test user2 ---------This is NOT Valid
testUser ---------This is Valid
testUser@2 ---------This is Valid
testUser2 ---------This is Valid
testUser.2 ---------This is NOT Valid
Please see below examples which needs to be satisfied with the regular expression.
Rule : 4-12 alphanumeric characters or special characters (~!@$%&*_+) at least one letter, no spaces
test ---------This is Valid
test@2 ---------This is Valid
test2 ---------This is Valid
2222 ---------This is NOT Valid
2222@ ---------This is NOT Valid
@2222 ---------This is NOT Valid
test user2 ---------This is NOT Valid
testUser ---------This is Valid
testUser@2 ---------This is Valid
testUser2 ---------This is Valid
testUser.2 ---------This is NOT Valid
Share
Improve this question
edited Apr 1, 2014 at 19:38
Gyhth
1,1659 silver badges22 bronze badges
asked Apr 1, 2014 at 19:36
Pawan PinjarkarPawan Pinjarkar
11 gold badge1 silver badge1 bronze badge
2
- 1 What have you tried so far? – Shreyos Adikari Commented Apr 1, 2014 at 19:37
- A tool like this helps you test as you go: regexpal. – DrLivingston Commented Apr 1, 2014 at 19:40
1 Answer
Reset to default 0This might work
/(?! )(?=.*[a-zA-Z])[a-zA-Z~!@$%&*_+]{4,12}/g
DEMO
本文标签:
版权声明:本文标题:javascript - Need regular expression for 4-12 alphanumeric characters or special characters (~!@$%&*_+) at least one let 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744988268a2636224.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论