Cheatsheet Pages / Regex Cheatsheet
How to repeat a pattern an exact number of times — {n}, {n,}, {n,m}
Star and plus are too vague: you need exactly 3 digits, at least 2, or between 4 and 8.
Patterns use the syntax shared by PCRE / Python / JavaScript; engine differences are flagged in the cheatsheet where they matter. Test any pattern at regex101.com — and pick the matching engine.
\d{3}-\d{4}
# "555-1234" — exactly 3 digits, dash, exactly 4 digits
\d{2,}
# at least 2 digits
[a-z]{4,8}
# 4 to 8 lowercase letters (e.g. a username rule)
