in reply to Regular expression for hexadecimal number

Checking a string whether it is the hexadecimal representation of some number (i.e. consists only of hexadecimal digits) is easily done with a regex. Assuming your string is in $_,
/^[[:xdigit:]]+$/
does that. I'm using the named character class [[:xdigit:]] in preference to the equivalent [0-9A-Fa-f].

Checking whether a number is in a specific range is usually quite hard to do with a regex. While your specific case is an exception (the range is all numbers with up to four digits, which can easily be checked with a regex) I wouldn't make use of that. Instead I'd use a numeric comparison which also works for other ranges:

/[[:xdigit]]+/ and hex( $_) <= 0xFFFF;
There is no need to check for >= 0 because Perl treats hexadecimal as unsigned, so every valid hex string will be non-negative.

Anno

Update: Trivial (=silly) mistake corrected.