     }
 
     private func removeClassesAndProtocols(from files: [FileRepresentation], in excluded: [String]) -> [FileRepresentation] {
+        return removeClassesAndProtocols(from: files, filter: { token in
+            guard let token = token as? ContainerToken else {
+                return true
+            }
+            return !excluded.contains(token.name)
+        })
+    }
+
+    private func removeClassesAndProtocols(from files: [FileRepresentation], using pattern: String) -> [FileRepresentation] {
+        guard !pattern.isEmpty else { return files }
+
+        let regex: NSRegularExpression
+        do {
+            regex = try NSRegularExpression(pattern: pattern, options: [])
+        } catch let error as NSError {
+            fatalError("Invalid regular expression:" + error.description)
+        }
+
+        return removeClassesAndProtocols(from: files, filter: { token in
+            guard let token = token as? ContainerToken else {
+                return true
+            }
+            return regex.firstMatch(in: token.name, options: [], range: NSMakeRange(0, token.name.count)) != nil
+        })
+    }
+
+    private func removeClassesAndProtocols(from files: [FileRepresentation], filter: (Token) -> Bool) -> [FileRepresentation] {
         return files.map {
-            FileRepresentation(sourceFile: $0.sourceFile, declarations: $0.declarations.filter { token in
-                guard let token = token as? ContainerToken else {
-                    return true
-                }
-                return !excluded.contains(token.name)
-            })
-        }.filter {
-            !$0.declarations.isEmpty
-        }
-    }
+            FileRepresentation(sourceFile: $0.sourceFile, declarations: $0.declarations.filter(filter))
+        }
+    }
+
 
     public struct Options: OptionsProtocol {
         let files: [String]

        let tokensWithInheritance = options.noInheritance ? tokens : mergeInheritance(tokens)
        let tokensWithoutClasses = options.noClassMocking ? removeClasses(tokensWithInheritance) : tokensWithInheritance
        // filter excluded classes/protocols
        let parsedFiles = removeClassesAndProtocols(from: tokensWithoutClasses, in: options.exclude)

        let headers = parsedFiles.map { options.noHeader ? "" : FileHeaderHandler.getHeader(of: $0, includeTimestamp: !options.noTimestamp) }
        let imports = parsedFiles.map { FileHeaderHandler.getImports(of: $0, testableFrameworks: options.testableFrameworks) }

                    noClassMocking: Bool,
                    debugMode: Bool,
                    globEnabled: Bool,
                    regex: String,
                    files: [String]) {

            self.output = output
