Would it be possible to make this "$class", since all your examples would match that? It at least makes it clear we're not trying to exclude .class files (which aren't excluded anyway because presumably this name doesn't happen to include the extension).