Using a greedy regex could lead to unintended consequences, like the inability to syntax highlight a unified diff. This resolves issues like that by using .*? instead of .* so that the closing +++ is matched as soon as possible.