init(_:as:transform:)
Creates a capture for the given component using the specified reference, transforming with the given closure.
Declaration
init<W, NewCapture>(_ component: some RegexComponent, as reference: Reference<NewCapture>, transform: @escaping (W) throws -> NewCapture) where Output == (Substring, NewCapture)Parameters
- component:
The regex component to capture.
- reference:
The reference to use for anything captured by
component. - transform:
A closure that takes the substring matched by
componentand returns a new value to capture. Iftransformthrows an error, matching is abandoned and the error is returned to the caller.