A regular expression atom is one repeatable part of a pattern: an individual character, a character class, or a parenthesized subpattern. Quantifiers can repeat any of these atoms, not only single characters. section 11.5.2
Repeating a character class
Use /\d{3}-\d{4}/ for a fixed-width pattern, /\d{1,10}/ for one to ten digits, and /\d{3,}/ for three or more. Ruby rejects impossible ranges such as {10,2}. section 11.5.2
Repeat versus capture
In /([A-Z]){5}/, the whole match can be BLACK, but the first capture is only K: the parenthesized atom matches one character repeatedly and retains the last capture. Move the quantifier inside the parentheses—/([A-Z]{5})/—to capture BLACK.
