有兩種寫法
(1)
let reg5:RegExp = /(\S)*.proto/i;
(2)
let reg5:RegExp = new RegExp('.*\.proto','i');
注意兩種方式表達任意一個字符的方式不同,字符串中用.
來表示任意字符。
正則表達式使用參考:https://javascript.ruanyifeng.com/stdlib/regexp.html
2. nodejs 遍歷文件夾
參考:
https://www.jianshu.com/p/f4460351e532
注意: 使用for file in files
是不對的,這樣得到的file的值是1,2,3 這樣的下標。