fix the regex and add option to overwrite old files