统计字母数字等字符
<script> function testx(o) { var v = o.value; var m1 = v.match(/[a-zA-Z]/g) || []; var m2 = v.match(/\d/g) || []; var m3 = v.match(/[^\da-zA-Z]/g) || []; alert("字母:" + m1.length + " , 数字:" + m2.length + " , 其他:" + m3.length); } </script>
时间: 2024-11-05 22:07:15