combine repeated patterns