change string code format from concatenation to pattern matching