Alternation #zm7 test seems wrong

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 -E “^I see (\d (cat|dog|cow)s?(, | and )?)+$”
it doesn’t return any match.
Am I missing something?

Hey @GianBarGian, it should be a match:

You can try it on https://regex101.com as well:

Am I missing something?

Could you run grep --version and share the output?

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

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