accounting for array indices in brack notation regular expression