I just need to know how to create a regular expression that takes a number containing up to two digits
All i have now
^[0-9]{2}$
Which will correspond to a number with exactly 2 digits, but I donβt know how to indicate "match a number that has up to two digits".
In addition, if there is a way to make sure that this number is not equal to 0, this will be a plus, otherwise I can check it with Bash.
Thanks!:)
Note that the input variable comes from read -p "makes a choice" Number
EDIT MY POST EXHIBITION CODE IN THE CONTEXT:
while true; do read -p "Please key in the number of the engineer of your choice, or leave empty to select them all: " Engineer if [ -z "$Engineer" ]; then echo "No particular user specified, all engineers will be selected." UserIdSqlString="Transactions.Creator!=0 " break else if [[ $Engineer =~ ^[0-9]{1,2}$ && $Engineer -ne 0 ]]; then echo "If you want a specific engineer type their number otherwise leave blank" else echo "yes" break fi fi done
source share