Changed RegexpOnFilename check to work with flags instead of more complex regexps