From the 2026-09-21 dogfood, CLI 0.11.2, Vale 3.21.0, recipe topic v8.
Step 3 of the recipe says tokens and swap "compile as Go RE2 regular expressions" and "lookahead and lookbehind do not exist in RE2. A rule that needs 'X but not when followed by Y' cannot be written as a single substitution; split it or narrow with scope."
Measured on the vendored binary with throwaway rules under test: \1, (?= bar) and (?<=x ) all fire on the fail fixture and stay quiet on pass. A rule we shipped today depends on a backreference and passes its fixtures:
extends: existence
raw:
- '\b(\w{3,}?)(s|es)?\b[^.!?\n]{0,60}[.!?] (It|We|They|That|This|You|I) (does not|doesn'\''t|can'\''t|cannot|don'\''t|do not|won'\''t|will not|never) \1(s|es)?\b'
That matches Vale's documented behavior: it compiles with Go regexp first and falls back to regexp2 when the pattern fails to compile, which is how lookaround and backreferences get through. The recipe's advice sends an author off to split a rule that could be one pattern.
What to do
- Recipe: replace the RE2 paragraph with "Go
regexp first, regexp2 fallback; lookaround and backreferences work but are slower, so keep them off hot paths and always prove them with a fixture."
- Keep the word-boundary and hyphen notes in that step; those measured true.
- No changeset (recipe only).
From the 2026-09-21 dogfood, CLI 0.11.2, Vale 3.21.0, recipe topic v8.
Step 3 of the recipe says
tokensandswap"compile as Go RE2 regular expressions" and "lookahead and lookbehind do not exist in RE2. A rule that needs 'X but not when followed by Y' cannot be written as a singlesubstitution; split it or narrow withscope."Measured on the vendored binary with throwaway rules under
test:\1,(?= bar)and(?<=x )all fire on the fail fixture and stay quiet on pass. A rule we shipped today depends on a backreference and passes its fixtures:That matches Vale's documented behavior: it compiles with Go
regexpfirst and falls back toregexp2when the pattern fails to compile, which is how lookaround and backreferences get through. The recipe's advice sends an author off to split a rule that could be one pattern.What to do
regexpfirst,regexp2fallback; lookaround and backreferences work but are slower, so keep them off hot paths and always prove them with a fixture."