Added method to process strings using Pattern and matcher.