Here's the break up of the regex (aa)+\1: (aa)+ matches the first two aa in the string. Remaining string - aaaa. There is more to be matched by (aa)+, so it goes on to match next aa. Remaining string - aa. Again (aa)+ can match the remaining string. So it matches the next aa. Remaining string - "". Remember, the quantifiers by default act ... More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.