These constants define the regular expression options. These constants are used by the property options, regularExpressionWithPattern:options:error:, and init(pattern:options:).


struct Options



static var caseInsensitive: NSRegularExpression.Options

Match letters in the pattern independent of case.

static var allowCommentsAndWhitespace: NSRegularExpression.Options

Ignore whitespace and #-prefixed comments in the pattern.

static var ignoreMetacharacters: NSRegularExpression.Options

Treat the entire pattern as a literal string.

static var dotMatchesLineSeparators: NSRegularExpression.Options

Allow . to match any character, including line separators.

static var anchorsMatchLines: NSRegularExpression.Options

Allow ^ and $ to match the start and end of lines.

static var useUnixLineSeparators: NSRegularExpression.Options

Treat only \n as a line separator (otherwise, all standard line separators are used).

static var useUnicodeWordBoundaries: NSRegularExpression.Options

Use Unicode TR#29 to specify word boundaries (otherwise, traditional regular expression word boundaries are used).


Conforms To

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