constgulp=require('gulp');constreplaceEach=require('gulp-replace-each');constKEYWORDS=['(Test)','(saySomething)',].map((value)=>{returnnewRegExp(value,'g');});gulp.task('replace-all',()=>{returngulp.task(['testFile.js']).pipe(replaceEach(KEYWORDS/* array or just RegExp object */,(arrayIndex,value,_1)=>{// the first argument is array index, other arguments are arguments from string replace function callbackletresult=_1;if(arrayIndex===1){result+='Funny';}else{result+='1';}returnresult;})).pipe(gulp.dest('dist'))});