Syntax for OR in gulp JavaScript variable

gulp, javascript, regex

Solution

The patterns used by gulp are those promoted by npm's glob package which doesn't use a precise regex pattern matching syntax, I imagine because these things start to look horrific when matching against paths.

the documentation regarding minimatch (used by glob) cover your described case:

'/**/*.+(jpg|png|tiff)'

Problem

This should be easy. I have this path variable declared in a `gulpfile.js`: ``` paths = { img: [ 'src/patternlab/**/**/*.jpg', 'src/patternlab/**/**/*.png' ] }; ``` I'd like to use a simple OR switch for the file extension, along the lines of: ``` 'src/patternlab/**/**/*.(jpg|png)' ``` But I can't find the right syntax! Have tried numerous permutations, looked through MDN etc…

Original source