'Is there a Regex to search for all arrays that are present in a project?

I am working on a large project in Xcode. I'm wanting to search, using the Find Navigator (See Below), for all arrays regardless of their name. I only care about any array that has this format, someArray[index].

enter image description here

Some Examples That Should Match

  • people[12]
  • section[0].rows[0]

Should Not Match

  • people[index]
  • section[section].row[row]

The regex should only return arrays, it should not return any dictionaries or other types that are not a subscripted array.

Why am I doing this? Well, it appears there have been some issues within our app where devs have not properly handled index out of bounds errors or nil values. There are far too many arrays for me to manually go through line by line to find them, so this is the best option I've come up with and it may not even be possible. If anyone has other recommendations, please feel free to share.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source