clone RegExps with flag preservation