$ echo -n "act" | ./your_program.sh -E "ca?t" (Test Expects a Match)

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:38: SyntaxWarning: invalid escape sequence '\d'
remote: [your_program]   if(pattern == "\d"):
remote: [your_program] /app/app/main.py:51: SyntaxWarning: invalid escape sequence '\w'
remote: [your_program]   elif pattern == "\w":
remote: [your_program] Logs from your program will appear here!
remote: [your_program] Pattern1: cat
remote: [your_program] Pattern2: ct
remote: [your_program] Pattern: a
remote: [your_program] Not matched
remote: [tester::#NY8] expected exit code 0, got 1
remote: [tester::#NY8] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

How is it a match ? Please clarify

Hey @cicada-581, ? matches zero or one occurrence of the preceding character.

So ca?t will match ct or cat. In this case, it matches ct:

Let me know if you’d like further clarification!