# \#challenge:grep

**URL:** https://forum.codecrafters.io/tag/challenge-grep/8.md

[Latest](https://forum.codecrafters.io/latest.md) · [Categories](https://forum.codecrafters.io/categories.md) · [Tags](https://forum.codecrafters.io/tags.md)

---

## [Anti-cheat (ac1) failed on grep challenge #sh9](https://forum.codecrafters.io/t/anti-cheat-ac1-failed-on-grep-challenge-sh9/16303)

<div class="topic-metadata">

**Author:** [@reaper8055](https://forum.codecrafters.io/u/reaper8055)\
**Replies:** 2\
**Last updated:** [October 14, 2026, 6:33pm UTC](https://forum.codecrafters.io/t/anti-cheat-ac1-failed-on-grep-challenge-sh9/16303 "2026-10-14T18:33:03Z")

</div>

I’m stuck on Stage Combining Character Classes #sh9. I’ve tried: not using regexp to match regexp Here are my logs: \[tester::#OQ2\] Running tests for Stage #OQ2 (Match digits) \[tester::#OQ2\] $ echo -n '123' | ./your\_…

---

## [Getting a timeout on one of the test cases in the auto color option](https://forum.codecrafters.io/t/getting-a-timeout-on-one-of-the-test-cases-in-the-auto-color-option/15867)

<div class="topic-metadata">

**Author:** [@Misttgun](https://forum.codecrafters.io/u/Misttgun)\
**Replies:** 8\
**Last updated:** [February 12, 2026, 1:22pm UTC](https://forum.codecrafters.io/t/getting-a-timeout-on-one-of-the-test-cases-in-the-auto-color-option/15867 "2026-02-12T13:22:50Z")

</div>

I’m stuck on Stage #NA5. Every previous test succeeded so far and the test I am failing on is not even checking for the auto. Here are my logs: \[tester::#NA5\] Running tests for Stage #NA5 (Highlighting - Implement the…

---

## [Nested Backreferences #xe5 tests greediness](https://forum.codecrafters.io/t/nested-backreferences-xe5-tests-greediness/2042)

<div class="topic-metadata">

**Author:** [@Gamma120](https://forum.codecrafters.io/u/Gamma120)\
**Replies:** 2\
**Last updated:** [January 25, 2026, 2:48pm UTC](https://forum.codecrafters.io/t/nested-backreferences-xe5-tests-greediness/2042 "2026-01-25T14:48:12Z")

</div>

Hello, The last stage of the backreferences extension (#xe5) has a case that test greediness: echo -n "abc-def is abc-def, not efg, abc, or def" | ./your\_program.sh -E "((\[abc\]+)-(\[def\]+)) is \\1, not (\[^xyz\]+), \\2, or …

---

## [Is there a problem with the tester? What is this situation? I have already output it](https://forum.codecrafters.io/t/is-there-a-problem-with-the-tester-what-is-this-situation-i-have-already-output-it/15702)

<div class="topic-metadata">

**Author:** [@HnustLzh2](https://forum.codecrafters.io/u/HnustLzh2)\
**Replies:** 3\
**Last updated:** [January 13, 2026, 12:50pm UTC](https://forum.codecrafters.io/t/is-there-a-problem-with-the-tester-what-is-this-situation-i-have-already-output-it/15702 "2026-01-13T12:50:05Z")

</div>

\[tester::#OL9\] Running tests for Stage #OL9 (File Search - Search a multi-line file) \[tester::#OL9\] \[setup\] echo “orange” \> “fruits-6854.txt” \[tester::#OL9\] \[setup\] echo “grape” \>\> “fruits-6854.txt” \[tester::#OL9\] \[se…

---

## [C track now supports grep](https://forum.codecrafters.io/t/c-track-now-supports-grep/15644)

<div class="topic-metadata">

**Author:** [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Replies:** 0\
**Last updated:** [December 15, 2025, 2:52am UTC](https://forum.codecrafters.io/t/c-track-now-supports-grep/15644 "2025-12-15T02:52:43Z")

</div>

Hey everyone! The C track now includes the Build your own grep challenge, which means it now supports all CodeCrafters challenges. Ready to put your C skills to the test? Jump into the C track, and let us know how it g…

---

## [Test errors stage #yx6](https://forum.codecrafters.io/t/test-errors-stage-yx6/15346)

<div class="topic-metadata">

**Author:** [@danilovict2](https://forum.codecrafters.io/u/danilovict2)\
**Replies:** 3\
**Last updated:** [November 16, 2025, 1:40pm UTC](https://forum.codecrafters.io/t/test-errors-stage-yx6/15346 "2025-11-16T13:40:53Z")

</div>

When I run tests for the stage #yx6 I get: \[tester::#YX6\] Running tests for Stage #YX6 (File Search - Recursive search) \[tester::#YX6\] \[setup\] echo "raspberry" \> "dir/fruits-9393.txt" \[tester::#YX6\] \[setup\] echo "pear" \>…

---

## [\#OL9 Multi Line file search, line not found](https://forum.codecrafters.io/t/ol9-multi-line-file-search-line-not-found/15466)

<div class="topic-metadata">

**Author:** [@Suchydudul](https://forum.codecrafters.io/u/Suchydudul)\
**Replies:** 1\
**Last updated:** [October 29, 2025, 7:32pm UTC](https://forum.codecrafters.io/t/ol9-multi-line-file-search-line-not-found/15466 "2025-10-29T19:32:34Z")

</div>

I’m stuck on Stage #OL9 I presume the tester cant read my output correctly, in the previous test where there was only one line everything worked I’ve tried changing the print statement i many ways (removing newline, us…

---

## [\[grep\] \[#NY8\] incorrect example \`dogs? does not match "dogss" (two "s")\`](https://forum.codecrafters.io/t/grep-ny8-incorrect-example-dogs-does-not-match-dogss-two-s/15437)

<div class="topic-metadata">

**Author:** [@matthew-russo](https://forum.codecrafters.io/u/matthew-russo)\
**Replies:** 1\
**Last updated:** [October 26, 2025, 11:15pm UTC](https://forum.codecrafters.io/t/grep-ny8-incorrect-example-dogs-does-not-match-dogss-two-s/15437 "2025-10-26T23:15:09Z")

</div>

grep stage #NY8 has an incorrect example: dogs? does not match dogss (two “s”) this correctly matches the substring dogs. in a terminal with a text file test.txt containing dogss produces a match with: grep -E ‘dogs?…

---

## [New extension: Quantifiers (grep)](https://forum.codecrafters.io/t/new-extension-quantifiers-grep/15374)

<div class="topic-metadata">

**Author:** [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Replies:** 0\
**Last updated:** [October 21, 2025, 2:21pm UTC](https://forum.codecrafters.io/t/new-extension-quantifiers-grep/15374 "2025-10-21T14:21:00Z")

</div>

The next extension for the grep challenge is now live: Quantifiers. Quantifiers let you match characters or expressions based on how many times they appear. By the end of this extension, your grep implementation wil…

---

## [\[grep\] \[C#\] Can't change the project structure](https://forum.codecrafters.io/t/grep-c-cant-change-the-project-structure/15372)

<div class="topic-metadata">

**Author:** [@PolarGoose](https://forum.codecrafters.io/u/PolarGoose)\
**Replies:** 4\
**Last updated:** [October 9, 2025, 1:22pm UTC](https://forum.codecrafters.io/t/grep-c-cant-change-the-project-structure/15372 "2025-10-09T13:22:04Z")

</div>

I would like to change the project structure to: grep.sln src/grep/grep.csproj src/test/test.csproj I changed the your\_program.sh and .codecrafters/compile.sh files so that they only build src/grep/grep.csproj. This a…

---

## [Anti-cheat (ac1) failed](https://forum.codecrafters.io/t/anti-cheat-ac1-failed/4541)

<div class="topic-metadata">

**Author:** [@itzVort3x1](https://forum.codecrafters.io/u/itzVort3x1)\
**Replies:** 3\
**Last updated:** [October 2, 2025, 4:35am UTC](https://forum.codecrafters.io/t/anti-cheat-ac1-failed/4541 "2025-10-02T04:35:23Z")

</div>

anti-cheat (ac1) failed. Please contact us at hello@codecrafters.io if you think this is a mistake. why am I seeing this error?

---

## [Stuck on Alternation, could use help. Stage ##zm7](https://forum.codecrafters.io/t/stuck-on-alternation-could-use-help-stage-zm7/15285)

<div class="topic-metadata">

**Author:** [@Ch-byte-afk](https://forum.codecrafters.io/u/Ch-byte-afk)\
**Replies:** 6\
**Last updated:** [September 24, 2025, 6:05pm UTC](https://forum.codecrafters.io/t/stuck-on-alternation-could-use-help-stage-zm7/15285 "2025-09-24T18:05:30Z")

</div>

I’m stuck on Stage ##zm7 I’ve been trying for nearing a month now, and at this point, my code is of dubious quality at best. The challenge is an absurd amount more difficult than all of the challenges before-hand, and …

---

## [\#RK3 not working but I swear the logic is right](https://forum.codecrafters.io/t/rk3-not-working-but-i-swear-the-logic-is-right/15311)

<div class="topic-metadata">

**Author:** [@MomentumSC](https://forum.codecrafters.io/u/MomentumSC)\
**Replies:** 2\
**Last updated:** [September 20, 2025, 4:23pm UTC](https://forum.codecrafters.io/t/rk3-not-working-but-i-swear-the-logic-is-right/15311 "2025-09-20T16:23:16Z")

</div>

def match\_pattern(input\_line, pattern): if len(pattern) == 1: return pattern in input\_line elif pattern == "\\d": return any(char.isdigit() for char in input\_line) elif pattern == "\\w": …

---

## [Alternation #zm7 test seems wrong](https://forum.codecrafters.io/t/alternation-zm7-test-seems-wrong/15287)

<div class="topic-metadata">

**Author:** [@GianBarGian](https://forum.codecrafters.io/u/GianBarGian)\
**Replies:** 2\
**Last updated:** [September 19, 2025, 9:34pm UTC](https://forum.codecrafters.io/t/alternation-zm7-test-seems-wrong/15287 "2025-09-19T21:34:54Z")

</div>

echo -n “I see 1 cat, 2 dogs and 3 cows” | ./your\_program.sh -E “^I see (\\d (cat|dog|cow)s?(, | and )?)+$” expect a match, but if I try to run the same command with grep echo -n “I see 1 cat, 2 dogs and 3 cows” | grep …

---

## [Stuck on Alternation in grep challenge](https://forum.codecrafters.io/t/stuck-on-alternation-in-grep-challenge/15246)

<div class="topic-metadata">

**Author:** [@danilovict2](https://forum.codecrafters.io/u/danilovict2)\
**Replies:** 2\
**Last updated:** [September 18, 2025, 6:34pm UTC](https://forum.codecrafters.io/t/stuck-on-alternation-in-grep-challenge/15246 "2025-09-18T18:34:47Z")

</div>

I’m currently stuck on Stage #ZM7. I’ve tried a few different approaches, but I suspect my core design might be off. Before I go back and rework everything, I’d love to hear any suggestions or ideas on how to get past th…

---

## [More accurate run command for the challenge](https://forum.codecrafters.io/t/more-accurate-run-command-for-the-challenge/15306)

<div class="topic-metadata">

**Author:** [@rohit-sutradhar-dev](https://forum.codecrafters.io/u/rohit-sutradhar-dev)\
**Replies:** 1\
**Last updated:** [September 17, 2025, 11:00pm UTC](https://forum.codecrafters.io/t/more-accurate-run-command-for-the-challenge/15306 "2025-09-17T23:00:07Z")

</div>

This is not regarding a specific stage. The command echo -n “\<input-string\>” | ./your\_program.sh -E “\\d” does not work for some inputs like $$ or $?, because these are special characters and are being interpreted and he…

---

## [Alternation and Grouping](https://forum.codecrafters.io/t/alternation-and-grouping/15292)

<div class="topic-metadata">

**Author:** [@FredericLatour](https://forum.codecrafters.io/u/FredericLatour)\
**Replies:** 2\
**Last updated:** [September 16, 2025, 1:56pm UTC](https://forum.codecrafters.io/t/alternation-and-grouping/15292 "2025-09-16T13:56:48Z")

</div>

Hi team, The following test, used to validate the “Alternation” stage: echo -n "I see 1 cat, 2 dogs and 3 cows" | ./your\_program.sh -E "^I see (\\d (cat|dog|cow)s?(, | and )?)+$" actually requires our implementation t…

---

## [Incorrect expected return in GREP #oq2?](https://forum.codecrafters.io/t/incorrect-expected-return-in-grep-oq2/15216)

<div class="topic-metadata">

**Author:** [@Ch-byte-afk](https://forum.codecrafters.io/u/Ch-byte-afk)\
**Replies:** 1\
**Last updated:** [September 6, 2025, 4:02am UTC](https://forum.codecrafters.io/t/incorrect-expected-return-in-grep-oq2/15216 "2025-09-06T04:02:40Z")

</div>

(topic deleted by author)

---

## [Add a complete step involving whole capturing groups](https://forum.codecrafters.io/t/add-a-complete-step-involving-whole-capturing-groups/14807)

<div class="topic-metadata">

**Author:** [@Spitfire7777](https://forum.codecrafters.io/u/Spitfire7777)\
**Replies:** 1\
**Last updated:** [August 21, 2025, 12:09pm UTC](https://forum.codecrafters.io/t/add-a-complete-step-involving-whole-capturing-groups/14807 "2025-08-21T12:09:15Z")

</div>

I’m stuck on Stage #ZM7. Since I am a kinda beginner developer, all the steps were not hard, since nothing involved capturing groups and processing them all together. But when I got to #ZM7, I was hit with this: echo -n…

---

## [Keep testing old version of code](https://forum.codecrafters.io/t/keep-testing-old-version-of-code/14982)

<div class="topic-metadata">

**Author:** [@morningbob](https://forum.codecrafters.io/u/morningbob)\
**Replies:** 6\
**Last updated:** [August 17, 2025, 1:38pm UTC](https://forum.codecrafters.io/t/keep-testing-old-version-of-code/14982 "2025-08-17T13:38:31Z")

</div>

I changed my code and git add and commit and push. But the server kept testing the old version of my code, already two days.

---

## [Match alphanumeric characters #mr9: bash $ expansion causes failed tests](https://forum.codecrafters.io/t/match-alphanumeric-characters-mr9-bash-expansion-causes-failed-tests/14247)

<div class="topic-metadata">

**Author:** [@danilogalisteu](https://forum.codecrafters.io/u/danilogalisteu)\
**Replies:** 1\
**Last updated:** [August 2, 2025, 5:40am UTC](https://forum.codecrafters.io/t/match-alphanumeric-characters-mr9-bash-expansion-causes-failed-tests/14247 "2025-08-02T05:40:34Z")

</div>

A specific test on stage #MR9 fails because the characters $- are expanded to “Builtin Set Flags” on bash. remote: \[tester::#MR9\] $ echo -n "×€÷\_$-×" | ./your\_program.sh -E "\\w" remote: \[tester::#MR9\] Expected exit code…

---

## [New extension: File Search (grep)](https://forum.codecrafters.io/t/new-extension-file-search-grep/14078)

<div class="topic-metadata">

**Author:** [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Replies:** 0\
**Last updated:** [July 28, 2025, 3:53pm UTC](https://forum.codecrafters.io/t/new-extension-file-search-grep/14078 "2025-07-28T15:53:00Z")

</div>

The next extension for the grep challenge is now live: File Search. This is what grep is designed for: scanning input files and printing lines that match a given pattern. By the end of this extension, your grep impl…

---

## [$ echo -n "act" | ./your\_program.sh -E "ca?t" (Test Expects a Match)](https://forum.codecrafters.io/t/echo-n-act-your-program-sh-e-ca-t-test-expects-a-match/10781)

<div class="topic-metadata">

**Author:** [@cicada-581](https://forum.codecrafters.io/u/cicada-581)\
**Replies:** 1\
**Last updated:** [May 20, 2025, 12:55pm UTC](https://forum.codecrafters.io/t/echo-n-act-your-program-sh-e-ca-t-test-expects-a-match/10781 "2025-05-20T12:55:43Z")

</div>

I’m stuck on Stage ##ny8 I’ve tried to test $ echo -n “act” | ./your\_program.sh -E “ca?t” Here are my logs: remote: \[tester::#NY8\] $ echo -n "act" | ./your\_program.sh -E "ca?t" remote: \[your\_program\] /app/app/main.py…

---

## [Echo -n "orange" | ./your\_program.sh -E "\[^opq\]" test report shows expected exit code is 0](https://forum.codecrafters.io/t/echo-n-orange-your-program-sh-e-opq-test-report-shows-expected-exit-code-is-0/10198)

<div class="topic-metadata">

**Author:** [@cicada-581](https://forum.codecrafters.io/u/cicada-581)\
**Replies:** 1\
**Last updated:** [May 8, 2025, 7:10pm UTC](https://forum.codecrafters.io/t/echo-n-orange-your-program-sh-e-opq-test-report-shows-expected-exit-code-is-0/10198 "2025-05-08T19:10:38Z")

</div>

I’m stuck on Stage #RK3. Here are my logs: remote: \[compile\] Moved ./.codecrafters/run.sh → ./your\_program.sh remote: \[compile\] Compilation successful. remote: remote: \[tester::#RK3\] Running tests for Stage #RK3 (Negat…

---

## [Tricky #ao7 case "^dog$" not matching "dogdogdog"](https://forum.codecrafters.io/t/tricky-ao7-case-dog-not-matching-dogdogdog/9136)

<div class="topic-metadata">

**Author:** [@HowieTKL](https://forum.codecrafters.io/u/HowieTKL)\
**Replies:** 2\
**Last updated:** [April 27, 2025, 9:48am UTC](https://forum.codecrafters.io/t/tricky-ao7-case-dog-not-matching-dogdogdog/9136 "2025-04-27T09:48:56Z")

</div>

According to grep behavior: echo dogdogdog | grep -E "^dog$" does NOT match. However, individually ^dog and dog$ will match dogdogdog. I do not believe the test cases capture this seemingly quirky scenario either. But…

---

## [\[GREP\]\[#NY8\] it should have input like "dog" to check pattern "dogs?"](https://forum.codecrafters.io/t/grep-ny8-it-should-have-input-like-dog-to-check-pattern-dogs/7720)

<div class="topic-metadata">

**Author:** [@KMohZaid](https://forum.codecrafters.io/u/KMohZaid)\
**Replies:** 2\
**Last updated:** [April 6, 2025, 4:15pm UTC](https://forum.codecrafters.io/t/grep-ny8-it-should-have-input-like-dog-to-check-pattern-dogs/7720 "2025-04-06T16:15:08Z")

</div>

this can make it more challenging to do

---

## [\#RK3 Negative Character Groups: Wrong test case?](https://forum.codecrafters.io/t/rk3-negative-character-groups-wrong-test-case/8090)

<div class="topic-metadata">

**Author:** [@0xi4o](https://forum.codecrafters.io/u/0xi4o)\
**Replies:** 2\
**Last updated:** [April 3, 2025, 2:45pm UTC](https://forum.codecrafters.io/t/rk3-negative-character-groups-wrong-test-case/8090 "2025-04-03T14:45:08Z")

</div>

One of the test cases for this stage is: echo -n "orange" | ./your\_program.sh -E "\[^opq\]" Challenge description says: “Negative character groups match any character that is not present within a pair of square brackets.…

---

## [Regarding anti cheat code error](https://forum.codecrafters.io/t/regarding-anti-cheat-code-error/7968)

<div class="topic-metadata">

**Author:** [@Neelesh56789](https://forum.codecrafters.io/u/Neelesh56789)\
**Replies:** 1\
**Last updated:** [March 31, 2025, 2:23pm UTC](https://forum.codecrafters.io/t/regarding-anti-cheat-code-error/7968 "2025-03-31T14:23:57Z")

</div>

I am getting this anti cheat code error even if all the test cases are passing, why?

---

## [\[GREP\]\[#XE5\] - Lot's of cheats on the code examples tab](https://forum.codecrafters.io/t/grep-xe5-lots-of-cheats-on-the-code-examples-tab/5026)

<div class="topic-metadata">

**Author:** [@eaverdeja](https://forum.codecrafters.io/u/eaverdeja)\
**Replies:** 8\
**Last updated:** [February 21, 2025, 10:24pm UTC](https://forum.codecrafters.io/t/grep-xe5-lots-of-cheats-on-the-code-examples-tab/5026 "2025-02-21T22:24:05Z")

</div>

While checking out the code examples on XE5, I noticed there are a lot of examples using re and hardcoding the patterns the tester will use :cry: Some examples even appear to be legit, with actual logic, but then they j…

---

## [\[rust\] Grep #A07 test case not consistent with the example command given](https://forum.codecrafters.io/t/rust-grep-a07-test-case-not-consistent-with-the-example-command-given/983)

<div class="topic-metadata">

**Author:** [@ndunnett](https://forum.codecrafters.io/u/ndunnett)\
**Replies:** 3\
**Last updated:** [December 25, 2024, 5:29pm UTC](https://forum.codecrafters.io/t/rust-grep-a07-test-case-not-consistent-with-the-example-command-given/983 "2024-12-25T17:29:52Z")

</div>

I’m not sure if this is true for the other test cases, but I’ve noticed this behaviour in #A07 because it initially caused my test to fail when running the CLI but pass when I copy/paste and run the command to run locall…

[Next page](https://forum.codecrafters.io/tag/challenge-grep/8.md?match_all_tags=true&page=1&tags%5B%5D=challenge%3Agrep)
