@@ -20,6 +20,18 @@ extension RegexProtocol {
2020 . init( self , transform: transform)
2121 }
2222
23+ public func tryCapture< NewCapture> (
24+ _ transform: @escaping ( Substring ) throws -> NewCapture
25+ ) -> CapturingGroup < Tuple2 < Substring , NewCapture > > where Match. Capture: EmptyCaptureProtocol {
26+ . init( self , transform: transform)
27+ }
28+
29+ public func tryCapture< NewCapture> (
30+ _ transform: @escaping ( Substring ) -> NewCapture ?
31+ ) -> CapturingGroup < Tuple2 < Substring , NewCapture > > where Match. Capture: EmptyCaptureProtocol {
32+ . init( self , transform: transform)
33+ }
34+
2335 public func capture< C0> ( ) -> CapturingGroup < Tuple3 < Substring , Substring , C0 > >
2436 where Match. Capture == C0 {
2537 . init( self )
@@ -31,6 +43,18 @@ extension RegexProtocol {
3143 . init( self , transform: transform)
3244 }
3345
46+ public func tryCapture< NewCapture, C0> (
47+ _ transform: @escaping ( Substring ) throws -> NewCapture
48+ ) -> CapturingGroup < Tuple3 < Substring , NewCapture , C0 > > where Match. Capture == C0 {
49+ . init( self , transform: transform)
50+ }
51+
52+ public func tryCapture< NewCapture, C0> (
53+ _ transform: @escaping ( Substring ) -> NewCapture ?
54+ ) -> CapturingGroup < Tuple3 < Substring , NewCapture , C0 > > where Match. Capture == C0 {
55+ . init( self , transform: transform)
56+ }
57+
3458 public func capture< C0, C1> ( ) -> CapturingGroup < Tuple4 < Substring , Substring , C0 , C1 > > where Match. Capture == Tuple2 < C0 , C1 > {
3559 . init( self )
3660 }
@@ -41,6 +65,18 @@ extension RegexProtocol {
4165 . init( self , transform: transform)
4266 }
4367
68+ public func tryCapture< NewCapture, C0, C1> (
69+ _ transform: @escaping ( Substring ) throws -> NewCapture
70+ ) -> CapturingGroup < Tuple4 < Substring , NewCapture , C0 , C1 > > where Match. Capture == Tuple2 < C0 , C1 > {
71+ . init( self , transform: transform)
72+ }
73+
74+ public func tryCapture< NewCapture, C0, C1> (
75+ _ transform: @escaping ( Substring ) -> NewCapture ?
76+ ) -> CapturingGroup < Tuple4 < Substring , NewCapture , C0 , C1 > > where Match. Capture == Tuple2 < C0 , C1 > {
77+ . init( self , transform: transform)
78+ }
79+
4480 public func capture< C0, C1, C2> ( ) -> CapturingGroup < Tuple5 < Substring , Substring , C0 , C1 , C2 > >
4581 where Match. Capture == Tuple3 < C0 , C1 , C2 > {
4682 . init( self )
@@ -51,6 +87,18 @@ extension RegexProtocol {
5187 ) -> CapturingGroup < Tuple5 < Substring , NewCapture , C0 , C1 , C2 > > where Match. Capture == Tuple3 < C0 , C1 , C2 > {
5288 . init( self , transform: transform)
5389 }
90+
91+ public func tryCapture< NewCapture, C0, C1, C2> (
92+ _ transform: @escaping ( Substring ) throws -> NewCapture
93+ ) -> CapturingGroup < Tuple5 < Substring , NewCapture , C0 , C1 , C2 > > where Match. Capture == Tuple3 < C0 , C1 , C2 > {
94+ . init( self , transform: transform)
95+ }
96+
97+ public func tryCapture< NewCapture, C0, C1, C2> (
98+ _ transform: @escaping ( Substring ) -> NewCapture ?
99+ ) -> CapturingGroup < Tuple5 < Substring , NewCapture , C0 , C1 , C2 > > where Match. Capture == Tuple3 < C0 , C1 , C2 > {
100+ . init( self , transform: transform)
101+ }
54102}
55103
56104/* Or using parameterized extensions and variadic generics.
0 commit comments