题目
判断输入是否是正确的邮箱格式
输入描述:
邮箱字符串
输出描述:
true表示格式正确
编辑
核心代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>邮箱字符串</title> </head> <body> <script>function isAvailableEmail(sEmail) { var reg = /^[0-9a-zA-Z_.]{1,}@[a-zA-Z0-9_.]{1,}[a-zA-Z0-9]{2,4}$/; // 正解 return reg.test(sEmail); } </script> </body> </html>