[BUG] Grep: `$` never matches at the end of a line in CRLF files, so anchored patterns find nothing on Windows
Status Open
Reported on v2.1.295
Maintainer reply None cached
Activity 1 comment · opened Oct 10, 2026
What's Wrong?
In a file with CRLF line endings, a Grep pattern ending in $ matches no line. ripgrep treats the \r before each \n as part of the line unless --crlf is given, and Grep does not pass it.
Patterns like ^def .*:$, APPLE$ or ^\s*$ are common in what Claude writes, and on Windows most text files are CRLF. Grep answers "No matches found", which reads as "this is not in the repo".
What Should Happen?
$ matches at the end of each line whether the file uses LF or CRLF (ripgrep's --crlf).
Steps to Reproduce
printf 'x\r\nfruit = APPLE\r\ny\r\n' > crlf_grep.txt- Grep
pattern: APPLE$,output_mode: contenton that file →No matches found - Grep
pattern: APPLEon the same file →2:fruit = APPLE
Controls on the same file:
$ rg -n 'APPLE$' crlf_grep.txt # exit 1, no output (what Grep does)
$ rg -n --crlf 'APPLE$' crlf_grep.txt # 2:fruit = APPLE
$ grep -n 'APPLE$' crlf_grep.txt # 2:fruit = APPLE (Git for Windows' grep)
Environment
- Claude Code 2.1.295 (Claude Desktop's Code tab), Windows 11
- Grep called directly; the model and prompt play no part
- The 2.1.296 changelog has no entry for this; I could not run 2.1.296 itself here
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗