in reply to regex capture and quantifiers

@matches = ($str =~ m/\(Related document\(s\)(\d+)\, (\d+)(?:\, (?:\[| +)(\d+)(?:\]|))*\)/i);

Others have discussed the answer to your original question (a capture group contains only the last sub-string matched and captured even though it may have matched and captured many times), but there is something else in the regex quoted above that I think merits comment.

The  (?:\[|) and  (?:\]|) regexes match either the  [ (left square bracket) or  ] (right square bracket), respectively, or else the empty pattern: note the  | alternation metacharacter. What the empty pattern matches is discussed in "The empty pattern //" sub-section of the discussion of the  m// operator in Regexp Quote-Like Operators in perlop and is probably not what you want. What you probably want is, respectively, something like  \[? and  \]? entirely replacing the grouped expressions.