\d is a PCRE extension. ERE (the POSIX regular expression standard) only guarantees [[:digit:]]. If you use \d in bash, it'll work on some operating systems -- where the standard C library's regex functions are extended -- and not others; it's always more reliable to stick to what the standard guarantees.
\dis a PCRE extension. ERE (the POSIX regular expression standard) only guarantees[[:digit:]]. If you use\din bash, it'll work on some operating systems -- where the standard C library's regex functions are extended -- and not others; it's always more reliable to stick to what the standard guarantees.=~doesn't do any implicit anchoring, so just[[ $1 =~ [[:digit:]] ]]will do; no need for the.*s.