From 1af60a84c2dc2ef72a49703af6bb1a8c9c44791f Mon Sep 17 00:00:00 2001 From: sarthakkaushik927 Date: Fri, 30 Oct 2026 11:34:09 +0530 Subject: [PATCH] Fix `content` parameter docs for regex replacing APIs The RegexBuilder replacing(...) and replace(...) overloads described their `content` parameter as "A closure that returns the collection to search for and replace", but the closure builds a regex. Say "regex" instead. Resolves swiftlang/swift#74008 Co-Authored-By: Claude Opus 5.5 --- Sources/RegexBuilder/Algorithms.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/RegexBuilder/Algorithms.swift b/Sources/RegexBuilder/Algorithms.swift index 19d3506b8..93bdf3e5c 100644 --- a/Sources/RegexBuilder/Algorithms.swift +++ b/Sources/RegexBuilder/Algorithms.swift @@ -186,7 +186,7 @@ where Self: BidirectionalCollection, SubSequence == Substring { /// the regex. /// - maxReplacements: A number specifying how many occurrences of /// the regex to replace. - /// - content: A closure that returns the collection to search for + /// - content: A closure that returns the regex to search for /// and replace. /// - Returns: A new collection in which all matches for regex in `subrange` /// are replaced by `replacement`, using `content` to create the regex. @@ -208,7 +208,7 @@ where Self: BidirectionalCollection, SubSequence == Substring { /// each match for the regex, using `content` to create the regex. /// - maxReplacements: A number specifying how many occurrences of regex /// to replace. - /// - content: A closure that returns the collection to search for + /// - content: A closure that returns the regex to search for /// and replace. /// - Returns: A new collection in which all matches for regex in `subrange` /// are replaced by `replacement`, using `content` to create the regex. @@ -229,7 +229,7 @@ where Self: BidirectionalCollection, SubSequence == Substring { /// each match for the regex, using `content` to 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 + /// - content: A closure that returns the regex to search for /// and replace. @available(SwiftStdlib 5.7, *) public mutating func replace( @@ -249,7 +249,7 @@ where Self: BidirectionalCollection, SubSequence == Substring { /// regex, using `content` to 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 + /// - content: A closure that returns the regex to search for /// and replace. /// - replacement: A closure that receives the full match information, /// including captures, and returns a replacement collection. @@ -273,7 +273,7 @@ where Self: BidirectionalCollection, SubSequence == Substring { /// - Parameters: /// - maxReplacements: A number specifying how many occurrences of /// the regex to replace, using `content` to create the regex. - /// - content: A closure that returns the collection to search for + /// - content: A closure that returns the regex to search for /// and replace. /// - replacement: A closure that receives the full match information, /// including captures, and returns a replacement collection. @@ -295,7 +295,7 @@ where Self: BidirectionalCollection, SubSequence == Substring { /// - Parameters: /// - maxReplacements: A number specifying how many occurrences of /// the regex to replace, using `content` to create the regex. - /// - content: A closure that returns the collection to search for + /// - content: A closure that returns the regex to search for /// and replace. /// - replacement: A closure that receives the full match information, /// including captures, and returns a replacement collection.