I'm trying to select two files with gulp.src
: highcharts.js
and highcharts.src.js
.
Of course I know I could add explicitly these two with an array expression, but for learning purposes I'm trying to write a single expression for them.
I've read that one can use simple regular expression syntax but it's not clear how.
I tried
gulp.src("highcharts(\.src)?\.js")
but it didn't match any files.
Gulp uses glob
which doesn't support the regular expressions you're normally used to. It uses special globbing patterns that are optimized to matching files.
Your example could be written as:
gulp.src('highcharts?(.src).js')
Check out the glob primer for more examples of what's possible with glob
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With