<!DOCTYPE html> <html> <head> <title></title> <script> window.onload=function(){ var str =‘2jJJJhJcus262i,jdh1‘ var reg=new RegExp(‘j‘,‘g‘) var arr=str.match(reg) console.log(arr) console.log(arr.length) } </script> </head> <body> </body> </html>
时间: 2024-10-25 15:03:33