The regex match operator `=~` is not supported in the single square brackets. You need double square brackets for it to work.
[[ $name =~ ^.[0-9]$ ]]
Note that you don't need a regex, you can use a normal pattern:
[[ $name = *[0-9] ]]
or, if you need the name to contain something before the digit,
[[ $name = *?[0-9] ]]