老师 交作业了 请检查一下

来源:2-11 编程练习

weixin_慕雪4394317

2022-12-25 16:29:24

<!--
 * @Author: Your Name you@example.com
 * @Date: 2022-11-27 17:36:41
 * @LastEditors: Your Name you@example.com
 * @LastEditTime: 2022-12-25 16:27:04
 * @FilePath: \草稿\01.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!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>Document</title>
    </style>
</head>

<body>
    <script>
        // 书写一个正则表达式
        var regexp = /^[0-9a-zA-Z_]{5}[^0]{1}$/;

        // 书写一个待测试的字符串
        var str = '123_a2';
        var str1 = 'abc1l0';
        var str2 = '12_AB4';

        // 测试正则表达式
        console.log(regexp.test(str));
        console.log(regexp.test(str1));
        console.log(regexp.test(str2));
    </script>
</body>

</html>


写回答

1回答

imooc_慕慕

2022-12-25

同学你好,代码验证没问题,很棒!祝学习愉快~


0
hmooc_慕慕
回复
hanielDu87
hp>同学你好,很感谢同学的反馈,weixin_暮雪4394317同学书写的不严谨,最后一位修改为如下方式:

https://img.mukewang.com/climg/63be1fde09a2f88a03930048.jpg

祝学习愉快~

h023-01-11
共2条回复

0 学习 · 17877 问题

查看课程