JS RegExp Quantifiers
Quantifiers say how many times a pattern may repeat. A brace range can constrain the length of a code.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
const code = /^[A-Z]{2,4}$/;
console.log(code.test("DIY"));
console.log(code.test("WORKSHOP"));
What happens
DIY fits the range, but WORKSHOP is too long.