ksh does not use regular expressions; it uses a simpler but still quite useful language called "shell globbing patterns". The key ideas are
- Classes like
[0-9]
or [chly]
match any character in the class.
- The
.
is not a special character; it matches only .
.
- The
?
matches any single character.
- The
*
matches any sequence of characters.
- Unlike regular expressions, shell globbing patterns must match the entire word, so it works as if it were a regexp it would always start with
^
and end with $
.
Globbing patterns are not as powerful as regular expressions, but they are much easier to read, and they are very convenient for matching filenames and simple words. The case
construct is my favorite for matching but there are others.
As already noted by Alok you probably want
case $number in
[0-9][0-9]) success ;;
*) failure;;
esac
Although possibly you might prefer not to match a two-digit number with initial zero, so prefer [1-9][0-9]
.