Instance Method

numberOfMatchesInString:options:range:

Returns the number of matches of the regular expression within the specified range of the string.

Declaration

- (NSUInteger)numberOfMatchesInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range;

Parameters

string

The string to search.

options

The matching options to use. See NSMatchingOptions for possible values.

range

The range of the string to search.

Return Value

The number of matches of the regular expression.

Discussion

This is a convenience method that calls enumerateMatchesInString:options:range:usingBlock:.

See Also

Searching Strings Using Regular Expressions

- enumerateMatchesInString:options:range:usingBlock:

Enumerates the string allowing the Block to handle each regular expression match.

- matchesInString:options:range:

Returns an array containing all the matches of the regular expression in the string.

- firstMatchInString:options:range:

Returns the first match of the regular expression within the specified range of the string.

- rangeOfFirstMatchInString:options:range:

Returns the range of the first match of the regular expression within the specified range of the string.