in reply to Another RegExp question

/^\d{3}\z/ matches exactly three digits.

Because it's easier to read (I'm guessing), /^\d{3}$/ is commonly used. That matches exactly three digits, or exactly three digits followed by a newline.