Instance Method

stringByReplacingMatchesInString:options:range:withTemplate:

Returns a new string containing matching regular expressions replaced with the template string.

Declaration

- (NSString *)stringByReplacingMatchesInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range withTemplate:(NSString *)templ;

Parameters

string

The string to search for values within.

options

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

range

The range of the string to search.

template

The substitution template used when replacing matching instances.

Return Value

A string with matching regular expressions replaced by the template string.

Discussion

See Flag Options for the format of template.

See Also

Replacing Strings Using Regular Expressions

- replaceMatchesInString:options:range:withTemplate:

Replaces regular expression matches within the mutable string using the template string.