Contents

replaceMatches(in:options:range:withTemplate:)

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

Declaration

func replaceMatches(in string: NSMutableString, options: NSRegularExpression.MatchingOptions = [], range: NSRange, withTemplate templ: String) -> Int

Parameters

  • string:

    The mutable string to search and replace values within.

  • options:

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

  • range:

    The range of the string to search.

  • templ:

    The substitution template used when replacing matching instances.

Return Value

The number of matches.

Discussion

See Flag Options for the format of templ.

See Also

Replacing Strings Using Regular Expressions