<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>42度空间-JavaScript中用户登录名的正则表达式及解析</title>
</head>
<body>
<div id="main"></div>
<script>
    var pattern = /^[a-zA-Z\u4E00-\u9FA5][a-zA-Z0-9\u4E00-\u9FA5_-]{3,15}$/;
    w("pattern.test('ifat3') = "+pattern.test('ifat3'));
    w("pattern.test('Ifat3') = "+pattern.test('Ifat3'));
    w("pattern.test('毛三胖子') = "+pattern.test('毛三胖子'));
    w("pattern.test('42du') = "+pattern.test('42du'));
    w("pattern.test('d42') = "+pattern.test('d42'));
    w("pattern.test('du42du42du42du421') = "+pattern.test('du42du42du42du421'));
    w("pattern.test('du42@') = "+pattern.test('du42@'));
    function w(val) {
        document.getElementById("main").innerHTML += val +"<br />";
    }
</script>
</body>
</html>