Frank I need a RegEx for the property files_exclude to only show files that end with, for example, .jpg, .png and .md
Interestingly, this is not straight-forward, and I had to look it up myself. Option files_exclude
is meant to exclude matches, but in this case, you want to include certain files and exclude the rest. The following should work, which will exclude all except the specified extensions. Keep in mind, with this you would need to specify everything you want to include, as everything else will be excluded.
'files_exclude' => '/^(?!.+[.](jpg|jpeg|png|md)$).+$/i',
As I write this, I figure we need another option files_include
. When populated, files_exclude
would be ignored, and it would only include files listed in files_include
. In your case, this would be something as simple as /\.(jp?eg|png|md)$/i.
Frank and to also exclude invisible dotfiles (e.g. .htaccess).
In this case, since we already have a rule that excludes all files except the ones specified, hidden files like .htaccess
would already be excluded.