make `collect` work even for iterables that don't provide length.

This also defined eltype for RegexMatchIterators, making it possible
to write collect(eachmatch(re,str)) for matchall(re,str). See #3525.