I\'m reading all the files in a single directory and I want to filter on JPG,JPEG,GIF and PNG.
Both capital and small letters. Those are the only files to be accepte
I think something is wrong with your regex. Try testing regexes here first: https://www.regexpal.com/
I think this one might work for you:
/^.*\.(jpg|jpeg|png|gif)$/i
Note the /i at the end - this is the "case insensitive" flag, saves you having to type out all permutations :)