regex test in bash

Hi

I want to do a regex test and branch based on the test result, but this doesn't seems to work :confused:

if [[ $lastele =~ \([0-9]\) ]]
then
echo success
else
echo failed
fi

You shouldn't backslash-escape the parentheses. But if your regular expression is that simple, you could also use case instead.

case $lastele in
  *[0-9]*) echo success;;
  *) echo failed >&2
esac