implemented replace_regex()