replace(with:maxReplacements:content:)
Replaces all matches for the regex in this collection, using the given closure to create the regex.
Declaration
mutating func replace<Replacement>(with replacement: Replacement, maxReplacements: Int = .max, @RegexComponentBuilder content: () -> some RegexComponent) where Replacement : Collection, Replacement.Element == CharacterParameters
- replacement:
The new elements to add to the collection in place of each match for the regex, using
contentto create the regex. - maxReplacements:
A number specifying how many occurrences of the regex to replace.
- content:
A closure that returns the collection to search for and replace.