This function is the basis for both pattern_matches_vec() and pattern_matches_outer()
and will be used with string-patterns-extras to replicate look-ahead and look-behind behaviour
It returns a flattened vector of Match objects
The outer options limits the matches to the whole matched sequence and excludes inner groups