+ static regex_t compiled_pattern;
+ static bool compile = true;
+ const int nmatches = 2;
+ regmatch_t matches[nmatches];
+
+ if (compile && regcomp (&compiled_pattern, "[mM][iI][dD]$", REG_EXTENDED)) {
+ return false;
+ } else {
+ compile = false;
+ }
+
+ if (regexec (&compiled_pattern, file.c_str(), nmatches, matches, 0)) {
+ return false;
+ }
+
+ return true;