Skip to content

Commit 15355bf

Browse files
authored
Convenience quoting (#305)
1 parent 00aa315 commit 15355bf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/_StringProcessing/Regex/Match.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,10 @@ extension Substring {
187187
try? r.regex.prefixMatch(in: self)
188188
}
189189
}
190+
191+
@available(SwiftStdlib 5.7, *)
192+
extension Regex {
193+
public init(quoting string: String) {
194+
self.init(node: .quotedLiteral(string))
195+
}
196+
}

0 commit comments

Comments
 (0)