<! DOCTYPE html> <html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="Width = device - width, initial - scale = 1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <script> var reg=/^[+-] (\d|[1-9]\d+)(\.\d+)? $/ console.log(reg.test('0.1'));
    console.log(reg.test('1 $989')); Var reg=/^1[3578]\d{9}$/ console.log(reg.test('13939394959'));
    console.log(reg.test('18515150044')); Var reg=/^1[34578]\d{9}/; console.log(reg.test('15509291341')); Var reg=/^[+-]? (\d|[1-9]\d+)(\.\d+)? $/; console.log(reg.test('0.1')); console.log(reg.test(1111234)); / / verification 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)); / / character name regular var reg = / ^ [\ u4e00 - \ u9fa5] {2} (\. [\ u4e00 - \ u9fa5] +)? $/ console.log(reg.test('Chang Wei-kin. Aisin Gioro'))
    console.log(reg.test('rabbit'))
 </script>
</body>
</html>
Copy the code