primer u Linux okruženju:
echo "516372"| egrep -o '[1-3]'
1
3
2
Dakle, možeš da upotrebiš character class: [1-3], ili [1,2,3].
E sad, ako treba ograničiti da ceo ulaz matchuje tačno jednu cifru, možeš da pokušaš sa ^[1-3]$
Attempt all the problems. Those you can do, don't do. Do the ones you cannot.