How to capture unknown number of matches using RegexBuilder?

I know how to match unknown number of fields with using 'range' and '.regularExpression' option as shown below, but how do i do it with the new RegexBuilder or multi-line literal?

    func matches(for regex: String, in text: String) -> [String] {
        var result = [String]()
        var startIndex = text.startIndex
        let endIndex = text.endIndex
        while let range = text.range(of: regex,
                                     options: .regularExpression,
                                     range: startIndex ..< endIndex)
        {
            result.append(String(text[range]))
            startIndex = range.upperBound
        }
        return result
    }

Just want to clarify, suppose I want to parse a table with multiple columns each separated by “|”, I can do one of the followings and use firstMatch(of: regex) or wholeMatch(of: regex), but they assume fixed number of columns in the table. How do I deal with dynamic number of columns?

	// using multi-line literal
        let regex = #/
        (\|)
        (?<year> (.*?)(?=\|))
        (\|)
        (?<company1> (.*?)(?=\|))
        (\|)
        (?<company2> (.*?)(?=\|))
        /#

	// using RegexBuilder
        let separator = /\|/
        let regexBuilder = Regex {
            separator
            Capture (
                OneOrMore(.any, .reluctant)
            )
            separator
            Capture (
                OneOrMore(.any, .reluctant)
            )
            separator
            Capture (
                OneOrMore(.any, .reluctant)
            )
            separator
        }
How to capture unknown number of matches using RegexBuilder?
 
 
Q