jsdiff icon indicating copy to clipboard operation
jsdiff copied to clipboard

Two regexes in parsePatch disagree about when a line with prefix `diff ` is a patch header

Open ExplodingCabbage opened this issue 2 weeks ago • 4 comments

Namely, this regex...

/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/

... and this regex:

/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/

In the former, diff bla matches; in the latter, it does not. This surely has some buggy or at least weird-and-arbitrary consequences.

ExplodingCabbage avatar Jan 07 '26 13:01 ExplodingCabbage