Type Method

regularExpressionWithPattern:options:error:

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

Declaration

+ (NSRegularExpression *)regularExpressionWithPattern:(NSString *)pattern options:(NSRegularExpressionOptions)options error:(NSError * _Nullable *)error;

Parameters

pattern

The regular expression pattern to compile.

options

The matching options. See NSRegularExpressionOptions for possible values. The values can be combined using the C-bitwise OR operator.

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.

Return Value

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

See Also

Creating Regular Expressions

- initWithPattern:options:error:

Returns an initialized 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