1234567891011121314151617 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <script>
- // g 匹配全局
- // i 不区分大小写
- const reg = /A/ig;
- let str = 'I have an apple and A banana';
- console.log(str.match(reg))
- </script>
- </body>
- </html>
|