Comparison between variable and regexp

Hi all,
How I could compare variable and regexp?
For example...
I am running the script ./aaa.sh -b [0-9]*
[0-9]* is variable $2 (second argument of script).

I would compare variables $a (generated from my cycle) and $2 as regexp.
I need from regular expression find file that satisfies this regexp.
I tried classic if [ "$a"="$2" ];... or if [ expr $a:$2 ]; ....but it isn't running ("Too many arguments")

Any ideas?

Try:

a=10
case $a in $2) echo variable \$a matches "$2"; esac

Use quoting around the pattern to pass it to the script:

$ ./aaa.sh -b "[0-9]*"
variable $a matches [0-9]*