# Matches Header information from the output of git diff (?m)^diff # diff line start \s--git\s # whitespace, then --git, then whitespace (?\S+) # From \s # Whitespace (?\S+) # To (?(?:.|\s){0,}?(?=\z|^index)) # Until 'index' ^index\s # Index Line Start (?\w+) # FromHash \.{2,2} # DotDot (?\w+) # ToHash \s(?\w+) # FileMode (?:.|\s){0,}?(?=\z|^---) # UntilDashLine \-{3,3}\s # DashLineAndWhitespace (?\S+) # FromUnified \s+\+{3,3}\s # PlusLineAndWhitespace (?\S+) # ToUnified \s