why "expr "${REPLY}" : '\([1-9][[:digit:]]*\)" can figure out whether it is a digit?

I found below script to check whether the variable is a digit in ksh.
############################
#!/bin/ksh

REPLY="3f"

if [[ `expr "${REPLY}" : '\([1-9][[:digit:]]*\)'` != ${REPLY} && "${REPLY}" != "0" ]]
then
print "is digit\n"
else
print "not digit\n"
fi
############################

Although it works fine, but i just can not understand the first part of if condition. it looks like a general expression though, but what command it is called? and how to explain the [[:digit:]]?

Please share your comments with me. Thanks in advance

[[:digit:]] - set of all digit

To find whether a string is digit or not you can use

#! /bin/ksh

myStr=$1
check_no=$(echo $myStr | tr -d '[0-9]')
if [[ $check_no = "" ]]
then
        echo "This is a digit"
else
        echo "This is not a digit"
fi

Check this:

if [ $(echo ${REPLY}|grep -c "[0-9]\{${#REPLY}\}") -eq 0 ]
then
   echo "No digit"
fi

you can use typeset -i in ksh
to enforce a number

billym.>typeset -i a
billym.>a=9
billym.>a=9.9
billym.>a=a8
ksh: a8: bad number

Deleted the message

Always works. Regards

great thx for all your kind reply.