Closed ycj1905 closed 7 years ago
The regex will match (/ /) and it has no problem for my IDE to replace globally .
However I write some codes below, and it will only replace the first match in every files.
Did I do something wrong ?
var replace = require('gulp-replace'); var re1 = new RegExp('/\\*(\\*)?(((?!\\*/)[\\s\\S])+)?\\*/'); gulp.task('regex', function(){ // gulp.src(['src/**/*.ts']) gulp.src(['src/**/*.ts']) .pipe(replace(re1, ' REMOVE SUCCESS ! ')) .pipe(gulp.dest('build/')); });
Before
After
well that's my fault ...
change to global will work fine :
var re1 = new RegExp('/\\*(\\*)?(((?!\\*/)[\\s\\S])+)?\\*/', 'g');
The regex will match (/ /) and it has no problem for my IDE to replace globally .
However I write some codes below, and it will only replace the first match in every files.
Did I do something wrong ?
Before
After