some other solutions:
Code:
grep 'array\[[0-9]\{2\}\]' file
fgrep 'array[25]' file
egrep 'array\[[0-9]+\]' file
grep 'array\[[0-9]\{1,\}\]' file
{2} specifies the number of repeats of [0-9]
fgrep matches literal strings so you can't use regexp.
egrep uses
extended regular expressions. So you can use the +
+ means one or more and is analogous to \{1,\} which is a regular expression so we can use that in grep in the last example.