Quick regex question

Say that I want to match any of the following:

abc[123]
def[4567]
ghi[89]

The letters will either be "abc", "def", or "ghi", only those three patterns. The numbers will vary, but there will only be numbers between the brackets.

I've only been able to match abc[123], using the following:

abc.[0-9]*.

I'm using a wildcard in place of the brackets because you apparently cannot match brackets with a regex (or so I've read while trying to research how to do this). However, this is odd... I would think that:

abc.[0-9]+.

should work because there has to be at LEAST one digit. However, it's not working. I can only get it to work using:

abc.[0-9]*.

I'm wondering if the fact that I'm executing this script on a mac has anything to do with it.

Does anyone know a way that I can match the above?

P.S. this is in the bash shell

I think that the program you are using to match regexp doesn't support extended regexp, for example:

echo "abc[123]" | grep "abc.[0-9]+."

this won't return anything, while this:

echo "abc[123]" | egrep "abc.[0-9]+."

will return the matching string.

Matching a square bracket will require an escape character "\":

echo "ghi[9876543]" | egrep "(abc|def|ghi)\[[0-9]+\]"