int CountSpecsInFile(string filePath) { var text = File.ReadAllText(filePath); var totalSpecs = Regex.Matches(text, "\\s+it\\(").Count; totalSpecs -= SubtractBrowserDependentSpecs(text, Request.Browser.Browser); return totalSpecs; }