Now I have a requirement, for example, let a = 'asdadaasd.jpg'||'Chinese.png';
2. Now I need to intercept .jpg||.png|| .gif||.jpeg The first 8 digits are '...'.png
let a = 'asdasdqweqweqwadsdasd.png'; let reg = /正则/; let strSub =>(filename){ xxx return filename } // 输出的 filename 为 asdasdqweq....png;
Practice your hands, it is not recommended to use regular rules
Regular method---code
This is the best way to actually intercept strings code: