From 35ddd784e2ec021983fbeb325c207ccb26f7f9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 29 Jan 2025 08:38:48 +0100 Subject: [PATCH] Clarify pygrep behaviour when matching at the end of a string It is not obvious that newline is included in the matched line and it took me quite some time to figure out. --- sections/new-hooks.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sections/new-hooks.md b/sections/new-hooks.md index 70699666..3f187582 100644 --- a/sections/new-hooks.md +++ b/sections/new-hooks.md @@ -489,6 +489,9 @@ For multiline matches, use `args: [--multiline]`. To require all files to match, use `args: [--negate]`. +The single line matches include trailing newline, you need to include it to +match something at the end of the string, for example `word\n$'. + __Support:__ pygrep hooks are supported on all platforms which pre-commit runs on.