splitByPattern: Splits a single character string by pattern
Description
Splits a single character string by pattern. The main difference compared to strsplit()
is that this method also returns the part of the string that matched
the pattern. Also, it only takes a single character string.