Instance Method

initWithPattern:options:error:

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

Declaration

- (instancetype)initWithPattern:(NSString *)pattern options:(NSRegularExpressionOptions)options error:(NSError * _Nullable *)error;

Parameters

pattern

The regular expression pattern to compile.

options

The regular expression options that are applied to the expression during matching. See NSRegularExpressionOptions 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

Creating Regular Expressions

+ regularExpressionWithPattern:options:error:

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software