Var reg=/^[+-]? (\d|[1-9]\d+)(\.\d+)? $/ console.log(reg.test('0.1'));
    console.log(reg.test('1 $989')); Var reg=/^1[34578]\d{9}/; console.log(reg.test('15509291341'));

    //3.验证是否是一个有效数字
    var reg=/^[+-]?(\d|[1-9]\d+)(\.\d+)?$/;
    console.log(reg.test('0.1')); console.log(reg.test(1111234)); / / 4. Validation is a mailbox var reg = / ^ + @ \ w/a - zA - Z0-9] {2, 10} \. (com) | cn $/; console.log(reg.test('[email protected]'))
    console.log(reg.test('[email protected]'[u4e00-u9fa5] var STR =Lion King; var reg=/^[\u4e00-\u9fa5]{2,}$/ console.log(reg.test(str)); Regular var / / 6. Chinese name reg = / ^ [\ u4e00 - \ u9fa5] {2} (\. [\ u4e00 - \ u9fa5] +)? $/ console.log(reg.test('Chang Wei-kin. Aisin Gioro'))
    console.log(reg.test('rabbit'))
 </script>
Copy the code