验证的要求是: 中文、英文、数字,长度4-10个字符
<input type='text' pattern='?'>
请问怎么写这个验证规则?
<input type='text' pattern='?'>
请问怎么写这个验证规则?
|
yesmeckApr 23, 2012
1
/[\u4e00-\u9fa5a-zA-Z0-9]{4,10}/
|
|
pepsinApr 23, 2012
2
/[a-zA-Z0-9\u4e00-\u9fa5]{4,10}/
大致是这样,我用的是Ruby正则的语法,可能要稍微修改下才能用你那吧 |
|
wynemoApr 23, 2012
3
import re
o1 = re.search(ur'[\u4e00-\u9fffa-z0-9]{4,10}',u']中abcdef123-') print o1.group() 中abcdef123 中文unicode的范围可能是这个 |
|
yesmeckApr 23, 2012
4
= =都忘了头尾吧~
/^[\u4e00-\u9fa5a-zA-Z0-9]{4,10}$/ |
|
wynemoApr 24, 2012
6
http://jsdo.it/dabin/k8sb 少侠很真懒啊 照这个写吧
|