Initializer

init(pattern:options:)

Returns an initialized NSRegularExpression instance with the specified regular expression pattern and options.

Declaration

init(pattern: String, options: NSRegularExpression.Options = []) throws

Parameters

pattern

The regular expression pattern to compile.

options

The regular expression options that are applied to the expression during matching. See NSRegularExpression.Options for possible values.

error

An out value that returns any error encountered during initialization. Returns an NSError object if the regular expression pattern is invalid; otherwise returns nil.firstMatchInString:options:range

Return Value

An instance of NSRegularExpression for the specified regular expression and options.

Discussion

See Also