@@ -226,3 +226,52 @@ public struct NegativeLookahead<Output>: _BuiltinRegexComponent {
226226 self . init ( _RegexFactory ( ) . negativeLookaheadNonCapturing ( component ( ) ) )
227227 }
228228}
229+
230+ // TODO: Write header doc
231+ @available ( SwiftStdlib 5 . 10 , * )
232+ public struct Lookbehind < Output> : _BuiltinRegexComponent {
233+ public var regex : Regex < Output >
234+
235+ init ( _ regex: Regex < Output > ) {
236+ self . regex = regex
237+ }
238+
239+ /// Creates a lookbehind from the given regex component.
240+ public init < R: RegexComponent > (
241+ _ component: R
242+ ) where R. RegexOutput == Output {
243+ self . init ( _RegexFactory ( ) . lookbehindNonCapturing ( component) )
244+ }
245+
246+ /// Creates a lookbehind from the regex generated by the given builder closure.
247+ public init < R: RegexComponent > (
248+ @RegexComponentBuilder _ component: ( ) -> R
249+ ) where R. RegexOutput == Output {
250+ self . init ( _RegexFactory ( ) . lookbehindNonCapturing ( component ( ) ) )
251+ }
252+ }
253+
254+ // TODO: Write header doc
255+ @available ( SwiftStdlib 5 . 10 , * )
256+ public struct NegativeLookbehind < Output> : _BuiltinRegexComponent {
257+ public var regex : Regex < Output >
258+
259+ init ( _ regex: Regex < Output > ) {
260+ self . regex = regex
261+ }
262+
263+ /// Creates a negative lookbehind from the given regex component.
264+ public init < R: RegexComponent > (
265+ _ component: R
266+ ) where R. RegexOutput == Output {
267+ self . init ( _RegexFactory ( ) . negativeLookbehindNonCapturing ( component) )
268+ }
269+
270+ /// Creates a negative lookbehind from the regex generated by the given builder
271+ /// closure.
272+ public init < R: RegexComponent > (
273+ @RegexComponentBuilder _ component: ( ) -> R
274+ ) where R. RegexOutput == Output {
275+ self . init ( _RegexFactory ( ) . negativeLookbehindNonCapturing ( component ( ) ) )
276+ }
277+ }
0 commit comments