Some minor discussion points below, that might not have been as obvious in context of the large proposal.
edit: I didn't realize I was listed as an author, as such I've rephrased my questions as discussion points 
// Parse the transaction kind.
TryCapture {
ChoiceOf {
"CREDIT"
"DEBIT"
}
} transform: {
TransactionKind(rawValue: String($0))
}
Any thoughts/bikeshedding for the transform label? Transform describes what it does, but it is a pretty generic term especially since the transform can fail producing a matching failure.
OneOrMore(.custom([
.characterClass(.word),
.characterClass(.whitespace)
]))
Note that .custom and .characterClass are not proposed here, they are proposed in Unicode for String Processing.
Repeat(.digit, count: 2)
Inside the detailed design, we see that the argument order is reversed for the resuilt-builder-taking variant, allowing something like
Repeat(count: 2) { CharacterClass.digit }
Repeat(2...2) { CharacterClass.digit }
AlternationBuilder is a result builder type for creating alternations from components of a block.
Alternation is technically precise name for advanced library authors, and I don't feel that it has to use the exact same terminology as the end-user-facing ChoiceOf.
With TryCapture, when the closure returns nil or throws, the failure becomes a no-match.
Clarification: a throw signals a pattern matching abort, meaning no backtracking to try alternatives. Returning nil will signal a local matching failure, backtracking to try alternatives.
public subscript(_ reference: Reference) -> Capture { get }
More details: This will trap if a reference wasn't present in the regex. We can debate whether it should return nil in that case (like Dictionary, but would be obnoxious at the use site, potentially) or whether there should be API to query a reference. This becomes interesting when the definition and use site grow farther apart in source code and time.
extension Regex {
public init<R: RegexComponent>(
@RegexComponentBuilder _ content: (Regex<Substring>) -> R
) where R.Output == Match
}
Regex { wholeSentence in
ChoiceOf {
"I"
"you"
}
"say"
ChoiceOf {
"goodbye"
"hello"
wholeSentence
}
}
Does this impact type checking and error messages at all? Most important would be any impact on diagnostics for non-recursive regexes, since closures and especially result builders can give less-than-useful error messages. I'm wondering if the use of a label somewhere could help, especially since it's not super clear at the use site what the role of the wholeSentence parameter is.
Support buildOptional and buildEither
Just to double check, we're not precluding ourselves from supporting builder-time if in the future. Parameterized regex construction could be very useful, but it totally makes sense to defer it as future work. There's a lot going on here as it is.
Flatten optionals
Clarification: this behavior matches the literal typing behavior. We're interested in ways to flatten them in the future, no concrete plans at this moment.