2.修饰符.html 473 B

12345678910111213141516171819
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script>
  10. // 修饰符
  11. // i 不区分大小写
  12. // g 全局匹配
  13. const reg = /hi/gi;
  14. console.log(reg.test("hello,haha,iloHi"))
  15. const str = 'hI, an Orange, HI, an Apple';
  16. console.log(str.match(reg));
  17. </script>
  18. </body>
  19. </html>