Alternation and Grouping

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 to handle grouping in general, not just alternation grouping. I think this requirement should be made clearer in the task description.

More broadly, I feel the task descriptions could benefit from being a bit more detailed overall.

2 Likes

Hey @FredericLatour, great suggestion!

We’ve simplified the combined test cases for #zm7 Alternation in this PR. Let us know if you’re still running into issues.

1 Like

Thanks for the feedback — though a bit too late for me, since I had already started implementing generic capturing groups :slightly_smiling_face:

On a more general note, it would be really helpful to have clearer guidance on how to handle edge cases. For example:

  • What if ^ isn’t at the start of a pattern? Should it be treated as a normal character?

  • What if $ isn’t at the end?

  • What about something like ab), or two consecutive quantifiers?

I ended up treating those as literals. Since they don’t seem to be covered in your tests, that didn’t stop me from passing the stages.

More precise guidance — or at least showing more of the test cases up front in each stage description — would make things smoother.

That being said, I’m enjoying this challenge. That’s really great to propose free challenges every month.
Thanks

2 Likes

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