Number of (non-overlapping) occurrences of pattern.
pattern
int countOccurrences(String pattern) => pattern.allMatches(this).length;