---
title: regularExpression
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsstring/compareoptions/regularexpression
---

# regularExpression

The search string is treated as an ICU-compatible regular expression. If set, no other options can apply except caseInsensitive and anchored. You can use this option only with the rangeOfString:… methods and replacingOccurrences(of:with:options:range:).

## Declaration

```swift
static var regularExpression: NSString.CompareOptions { get }
```

## See Also

### Constants

- [caseInsensitive](foundation/nsstring/compareoptions/caseinsensitive.md)
- [literal](foundation/nsstring/compareoptions/literal.md)
- [backwards](foundation/nsstring/compareoptions/backwards.md)
- [anchored](foundation/nsstring/compareoptions/anchored.md)
- [numeric](foundation/nsstring/compareoptions/numeric.md)
- [diacriticInsensitive](foundation/nsstring/compareoptions/diacriticinsensitive.md)
- [widthInsensitive](foundation/nsstring/compareoptions/widthinsensitive.md)
- [forcedOrdering](foundation/nsstring/compareoptions/forcedordering.md)
