"For those of you looking for just the summary tips, they are: Explicitly compile; reuse the Matcher; use find; strip leading and trailing .*; use indexOf to rule out non-matching lines; watch out for very long lines. Now there is no need to read further unless you are interested in the details."
"The regular expression library can have exponentially bad performance against long lines for some types of matches (one known case is find() with a leading .* failing to match against a long lines)."