rangeOfFirstMatch(in:options:range:)
Returns the range of the first match of the regular expression within the specified range of the string.
Declaration
func rangeOfFirstMatch(in string: String, options: NSRegularExpression.MatchingOptions = [], range: NSRange) -> NSRangeParameters
- string:
The string to search.
- options:
The matching options to use. See Matchingoptions for possible values.
- range:
The range of the string to search.
Return Value
The range of the first match. Returns {NSNotFound, 0} if no match is found.
Discussion
This is a convenience method that calls enumerateMatches(in:options:range:using:).