Repeat exactly n times
{n} means "exactly n occurrences of the previous element." Not more, not less.
Pattern \d{4} matches exactly four digits. Pattern a{3} matches exactly three a's. Pattern (ab){5} matches exactly five repetitions of 'ab' (so 'ababababab').
Where it shines
Fixed-length data formats: 4-digit years, 16-digit credit card numbers, 6-character hex colors, 5-digit ZIP codes, 4-block UUIDs. Anywhere the spec says "exactly N characters," {n} says it back.
Watch the boundary
By itself, \d{4} happily matches 4 consecutive digits in the middle of a longer run. re.findall(r'\d{4}', '20260504') returns ['2026', '0504'] — both 4-digit chunks of the 8-digit string. To prevent this, anchor with \b or ^...$: \b\d{4}\b won't match if there are digits on either side.