Hacker News new | ask | show | jobs
by simonw 953 days ago
There's a comment about that here: https://github.com/git/git/blob/bc5204569f7db44d22477485afd5...

    When writing or updating patterns, assume that the contents these
    patterns are applied to are syntactically correct.  The patterns
    can be simple without implementing all syntactical corner cases, as
    long as they are sufficiently permissive.
1 comments

Wow, that file must be paradise for regex nerds, assuming there are any such...
there are, I am, and it's not (sorry). some languages have the ability to comment regexes, and that would be very useful here.
It has lots of comments inside the regexes. How would this better comment support look like?
These are not technically "comments inside the regexes", that would be something like the "Delete (most) C comments." regex here: https://perldoc.perl.org/perlre#/x-and-/xx

Here, instead, they've used string juxtaposition cleverly to write comments between parts of the regex/string. It effectively serves the same purpose though.

there are, I am, and it is. (Except for the proliferation of backslashes due to C not having "raw" strings.)