Before submitting
Summary
In the builtin regex pattern hooks, lookaround works for selecting filenames (files), but is broken for file content (args). Output for the given .pre-commit-config.yaml is:
$ prek -a
deny patterns............................................................ error: Failed to run hook `deny-pattern`
caused by: Failed to compile regex patterns
caused by: error parsing pattern 0
caused by: regex parse error:
^uses (?!negative lookahead)
^^^
error: look-around, including look-ahead and look-behind, is not supported
After removing the lookahead expression only from args and keeping it in files, prek works as expected.
Platform
Ubuntu 24.04 amd64
Version (current: 0.5.3)
prek 0.5.3
.pre-commit-config.yaml
repos:
- repo: builtin
hooks:
- id: deny-pattern
files: '^.*(?!negative lookahead)'
args:
- '^uses (?!negative lookahead)'
Log file
2026-09-18T08:53:51.563994Z DEBUG prek: 0.5.3
2026-09-18T08:53:51.564021Z DEBUG Args: ["prek", "-a"]
2026-09-18T08:53:51.564995Z TRACE root: close time.busy=960µs time.idle=1.93µs
2026-09-18T08:53:51.565013Z DEBUG Git root: /home/me/tmp/prek-regex-reproducer
2026-09-18T08:53:51.565025Z DEBUG Found workspace root at `/home/me/tmp/prek-regex-reproducer`
2026-09-18T08:53:51.565029Z TRACE Include selectors: ``
2026-09-18T08:53:51.565031Z TRACE Skip selectors: ``
2026-09-18T08:53:51.565062Z DEBUG discover{root="/home/me/tmp/prek-regex-reproducer" config=None refresh=false}: Loaded workspace from cache
2026-09-18T08:53:51.565067Z DEBUG discover{root="/home/me/tmp/prek-regex-reproducer" config=None refresh=false}: Loading project configuration path=.pre-commit-config.yaml
2026-09-18T08:53:51.565236Z TRACE discover{root="/home/me/tmp/prek-regex-reproducer" config=None refresh=false}: close time.busy=197µs time.idle=671ns
2026-09-18T08:53:51.565412Z TRACE Checking lock resource="store" path=/home/me/.cache/prek/.lock
2026-09-18T08:53:51.565420Z DEBUG Acquired lock resource="store"
2026-09-18T08:53:51.565535Z TRACE Released lock path=/home/me/.cache/prek/.lock
2026-09-18T08:53:51.565541Z DEBUG Hooks going to run: ["deny-pattern"]
2026-09-18T08:53:51.565551Z TRACE ls_files{cwd="/home/me/tmp/prek-regex-reproducer"}: Executing `cd /home/me/tmp/prek-regex-reproducer && /usr/bin/git -c core.useBuiltinFSMonitor=false --literal-pathspecs ls-files -z -- /home/me/tmp/prek-regex-reproducer`
2026-09-18T08:53:51.566458Z TRACE ls_files{cwd="/home/me/tmp/prek-regex-reproducer"}: close time.busy=206µs time.idle=705µs
2026-09-18T08:53:51.566470Z DEBUG All files in the workspace: 447
2026-09-18T08:53:51.568935Z TRACE Files for project `.` after filtered: 447
2026-09-18T08:53:51.568948Z DEBUG Running priority group with priority 0: ["deny-pattern"]
2026-09-18T08:53:51.569071Z TRACE matching_filenames{hook="deny-pattern"}: close time.busy=115µs time.idle=1.48µs
2026-09-18T08:53:51.569077Z TRACE Files for hook `deny-pattern` after filtering matched=true filenames=444
2026-09-18T08:53:51.569188Z INFO run{hook_id=deny-pattern language=system}: close time.busy=101µs time.idle=522ns
Before submitting
Summary
In the builtin regex pattern hooks, lookaround works for selecting filenames (
files), but is broken for file content (args). Output for the given.pre-commit-config.yamlis:After removing the lookahead expression only from
argsand keeping it infiles, prek works as expected.Platform
Ubuntu 24.04 amd64
Version (current: 0.5.3)
prek 0.5.3
.pre-commit-config.yaml
Log file