Making REGEX_OPTIONAL greedy, allowing arrays in brackets