map regex to replacement and add loop