Matcher (String line) { if (line.contains("[")) { Matcher m = ourYourkitThreadStartPattern.matcher(line); if (m.matches()) return m; } if (line.contains("CPU usage on sample:")) { Matcher m = ourYourkitThreadStartPattern2.matcher(line); if (m.matches()) return m; } return null; }