日期:2014-05-16 浏览次数:20417 次
<script type="text/javascript"> var p = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[\u4e00-\u9fa5]).*$/ var arr=["asdf汉字","1a^","1A","11","1a2A","a1b2c汉字","a1汉字b2cA"] for(var i=0;i<arr.length;i++){ document.write(arr[i].replace(" "," ")+":"+p.test(arr[i])+"<br/>"); } </script>
------解决方案--------------------
/^[a-zA-Z0-9\u4E00-\u9FFF]{2,10}$/
------解决方案--------------------
一时搞错,再来
<script type="text/javascript"> var p = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[\u4e00-\u9fa5])[\da-zA-Z\u4e00-\u9fa5]+$/ var arr=["asdf汉字","1a^","1A","11","1a2A","a1b2c汉字","a1汉字b2cA!"] for(var i=0;i<arr.length;i++){ document.write(arr[i].replace(" "," ")+":"+p.test(arr[i])+"<br/>"); } </script>
------解决方案--------------------
哦,我那个是三者都一定要输入了,结合2楼的话用/^[a-zA-Z0-9\u4E00-\u9FFF]+$/吧
------解决方案--------------------