/^\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.
In reply to Re: Another RegExp question
by ikegami
in thread Another RegExp question
by Ronnie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |