Contents

init(_:transform:)

Creates a capture for the given component, attempting to transform with the given closure.

Declaration

init<W, C1, C2, C3, C4, C5, C6, C7, C8, C9, NewCapture>(_ component: some RegexComponent, transform: @escaping (W) throws -> NewCapture?) where Output == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9)

Parameters

  • component:

    The regex component to capture.

  • transform:

    A closure that takes the substring matched by component and returns a new value to capture, or nil if matching should proceed, backtracking if allowed. If transform throws an error, matching is abandoned and the error is returned to the caller.