From: Junio C Hamano Date: Sat, 14 Feb 2026 15:42:54 GMT Subject: Re: [PATCH v2 2/2] templates: detect commit messages containing diffs Message-ID: In-Reply-To: <20ed1f26-f60b-4e30-a0a5-8bd01dee19d1@gmail.com> Phillip Wood writes: >>> The trailing ".*" when matching commented lines >>> ensures that if the comment string ends with a "$" it is not treated >>> as an anchor. >> >> I am not sure what this means. Wouldn't these three >> >> sed -e '/^#/d' >> sed -e '/^#.*/d' >> sed -e '/^#.*$/d' >> >> work exactly the same way? > > They do, but if the comment string is '$' then these two > > sed -e '/^$/d' > sed -e '/^$.*/d' > > have different meanings Ahh, that is what you meant. Having to write "/^\$/" is inconvenient, because others characters do not generally need the backslash (e.g., "/^\#/" and "/^#/" are the same) and some characters even may become nonsensical if we blindly add backslash to everybody (e.g., "/^\1/"). Nobody would use "[" as a commentchar, I hope, as "/^[/d" would not work, and neither "/^[.*/d" does. Thanks.