Using PHP's preg_match() function, how would I go about matching words that are between 2 and 5 characters? In this case the letters are guaranteed to be uppercase A-Z and there is only one word in each $word variable.
It must reject a word of 6 characters:
preg_match("/[A-Z]{2,5}/", $word);
...does not appear to work, presumably because a 6 character $word will match based on the first 2-5 characters.
This is a simplified version of my actual problem which cannot be solved with a strlen() test.