# Echo -n "orange" | ./your\_program.sh -E "\[^opq\]" test report shows expected exit code is 0

**URL:** <https://forum.codecrafters.io/t/echo-n-orange-your-program-sh-e-opq-test-report-shows-expected-exit-code-is-0/10198>\
**Category:** Challenges\
**Tags:** challenge:grep\
**Created:** [May 8, 2025, 6:37pm 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-08T18:37:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cicada-581](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/cicada-581/32/32_2.png) [@cicada-581](https://forum.codecrafters.io/u/cicada-581)\
**Post date:** [May 8, 2025, 6:37pm UTC](https://forum.codecrafters.io/t/echo-n-orange-your-program-sh-e-opq-test-report-shows-expected-exit-code-is-0/10198/1 "2025-05-08T18:37:24Z")

</div>

I’m stuck on Stage #RK3.

Here are my logs:

```auto
remote: [compile] Moved ./.codecrafters/run.sh → ./your_program.sh
remote: [compile] Compilation successful.
remote:
remote: [tester::#RK3] Running tests for Stage #RK3 (Negative Character Groups)
remote: [tester::#RK3] $ echo -n "apple" | ./your_program.sh -E "[^xyz]"
remote: [your_program] /app/app/main.py:11: SyntaxWarning: invalid escape sequence '\d'
remote: [your_program] if(pattern == "\d"):
remote: [your_program] /app/app/main.py:14: SyntaxWarning: invalid escape sequence '\w'
remote: [your_program] elif pattern == "\w":
remote: [your_program] Logs from your program will appear here!
remote: [tester::#RK3] ✓ Received exit code 0.
remote: [tester::#RK3] $ echo -n "banana" | ./your_program.sh -E "[^anb]"
remote: [your_program] /app/app/main.py:11: SyntaxWarning: invalid escape sequence '\d'
remote: [your_program] if(pattern == "\d"):
remote: [your_program] /app/app/main.py:14: SyntaxWarning: invalid escape sequence '\w'
remote: [your_program] elif pattern == "\w":
remote: [your_program] Logs from your program will appear here!
remote: [tester::#RK3] ✓ Received exit code 1.
remote: [tester::#RK3] $ echo -n "orange" | ./your_program.sh -E "[^opq]"
remote: [your_program] /app/app/main.py:11: SyntaxWarning: invalid escape sequence '\d'
remote: [your_program] if(pattern == "\d"):
remote: [your_program] /app/app/main.py:14: SyntaxWarning: invalid escape sequence '\w'
remote: [your_program] elif pattern == "\w":
remote: [your_program] Logs from your program will appear here!
remote: [tester::#RK3] expected exit code 0, got 1

```

And here’s a snippet of my code:

```auto
 elif pattern.startswith("[^") and pattern.endswith("]"):
        for char in pattern[2:-2]:
            if char not in input_line:
                continue
            else:
                excludePattern = False
                break
                #print(char)
        return excludePattern

```

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [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/4 "2025-05-08T19:10:38Z")

</div>

Hey @cicada-581, your code should check if any character from the input is **not** in the pattern, not the other way around.

You can try running this command:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/6/64e707e7b737db4d6a532dceb64263cf54bcca65.png)

1. **o** is in **opq** , so we continue;
2. But all of **range** is **not** in **opq** , so any of them can trigger a match.

Let me know if you’d like further clarification!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [May 18, 2025, 8:35am UTC](https://forum.codecrafters.io/t/echo-n-orange-your-program-sh-e-opq-test-report-shows-expected-exit-code-is-0/10198/6 "2025-05-18T08:35:15Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
