Function to parse a string for possible combination