in reply to Error in my Regular expression pattern
Do you now wonder how it comes that if you don't remove the top card, you can deal 52 cards evenly, but you cannot if you do?
- You have a deck of cards (52).
- You remove the top card.
- You deal the remaining cards among 4 players.
- You end up one short.
- Now, you collect all cards again.
- This time, you don't remove the top card.
- You deal the remaining card among the 4 players.
That's the same what's happening here. There are 2 matches of twinkle in your string. If you first match one, then the rest, the "rest" only matches once. If you only match "the rest", you get both matches.