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