split the regexp patterns into initial, repeated and final.