support replace with  multiple groups.