И у вас в исходной строке есть еще две буквы s, в словах dkjgkjsff others
const reg = new RegExp('card|s|s|s|s', 'g');
new RegExp('card|s|s', 'g');
str.replace(reg, (sp, match) => {
console.log(sp,match) // card, s, s
})
Details:
errno: -4048
code: EPERM
syscall: scandir
path: C:\$Recycle.Bin\S-1-5-18
Stack:
Error: EPERM: operation not permitted, scandir 'C:\$Recycle.Bin\S-1-5-18'
at Error (native)
at Object.fs.readdirSync (fs.js:951:18)
at Glob._readdir (C:\OpenServer\domains\stonyy\skin\frontend\istone\stonyy\assets\node_modules\globule\node_modules\glob\glob.js:577:20)
at Glob._process (C:\OpenServer\domains\stonyy\skin\frontend\istone\stonyy\assets\node_modules\globule\node_modules\glob\glob.js:379:15)
at Glob.<anonymous> (C:\OpenServer\domains\stonyy\skin\frontend\istone\stonyy\assets\node_modules\globule\node_modules\glob\glob.js:403:14)
at Array.forEach (native)
at Glob.<anonymous> (C:\OpenServer\domains\stonyy\skin\frontend\istone\stonyy\assets\node_modules\globule\node_modules\glob\glob.js:402:9)
at Glob._readdir (C:\OpenServer\domains\stonyy\skin\frontend\istone\stonyy\assets\node_modules\globule\node_modules\glob\glob.js:554:32)
at Glob._process (C:\OpenServer\domains\stonyy\skin\frontend\istone\stonyy\assets\node_modules\globule\node_modules\glob\glob.js:379:15)
at Glob.<anonymous> (C:\OpenServer\domains\stonyy\skin\frontend\istone\stonyy\assets\node_modules\globule\node_modules\glob\glob.js:403:14)