init(_:_:)
Creates a regex component that matches the given component zero or one times.
Declaration
init<W, C1>(_ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ componentBuilder: () -> some RegexComponent) where Output == (Substring, C1?)Parameters
- behavior:
The repetition behavior to use when repeating
componentin the match. Ifbehaviorisnil, the default repetition behavior is used, which can be changed fromeagerby callingrepetitionBehavior(_:)on the resultingRegex. - componentBuilder:
A builder closure that generates a regex component.