HF RL Explorer

Task: Capture Multiple Repeated Regex Groups in Swift

Task: Capture Multiple Repeated Regex Groups in Swift: a task in Terminal-Lego-15k (Harbor dataset). In many regex implementations, when you use a repeated capturing group like ^(?:( A-Z +),?)+$ , only the last match of the repeated group is captured. Your task is to write a Swift program that…

The task

In many regex implementations, when you use a repeated capturing group like `^(?:([A-Z]+),?)+$`, only the last match of the repeated group is captured. Your task is to write a Swift program that correctly captures **all** occurrences of a repeated pattern from a comma-separated string of uppercase words.

Part of PrimeIntellect/Terminal-Lego-15k.