fixed path regex
fixed detect_path_format
fixed rewrite path format
added doctests for _detect_patch_header_format
fixed rewrite_patch_header