firstMatch(of:)

Returns the first match for the regex within this collection, where the regex is created by the given closure.

iOS
16.0+
macOS
13.0+
tvOS
16.0+
watchOS
9.0+
func firstMatch<Output>(@RegexComponentBuilder of content: () -> some RegexComponent) -> Regex<Output>.Match?

Parameters

content

A closure that returns the regex to search for.

Returns

The first match for the regex created by content in this collection, or nil if no match is found.