2.修饰符.html 440 B

123456789101112131415161718
  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. const reg = /an/g;
  11. console.log(reg.test('aA'));
  12. console.log(reg.test('aab'));
  13. console.log(reg.test('aba'));
  14. var str = 'an Apple,an Egg'
  15. console.log(str.match(reg));
  16. </script>
  17. </body>
  18. </html>