0001    /// `Options` defines alternate behaviours of regular expressions when matching.
0002    public struct Options
Options.swift:10
  public static let IgnoreCase = Options(rawValue: 1)
Options.swift:19
  public static let IgnoreMetacharacters = Options(rawValue: 1 << 1)
Options.swift:27
  public static let AnchorsMatchLines = Options(rawValue: 1 << 2)
Options.swift:39
internal extension Options {
Regex.swift:18
  public init(string pattern: String, options: Options = []) throws {
Regex.swift:37
  public init(_ pattern: StaticString, options: Options = []) {
: OptionSetType { 0003 0004 /// Ignores the case of letters when matching. 0005 /// 0006 /// Example: 0007 /// 0008 /// let a = Regex("a", options: .IgnoreCase) 0009 /// a.allMatches("aA").map { $0.matchedString } // ["a", "A"] 0010 public static let IgnoreCase
Options.swift:46
    if contains(.IgnoreCase) { options.insert(.CaseInsensitive) }
= Options(rawValue: 1) 0011 0012 /// Ignore any metacharacters in the pattern, treating every character as 0013 /// a literal. 0014 /// 0015 /// Example: 0016 /// 0017 /// let parens = Regex("()", options: .IgnoreMetacharacters) 0018 /// parens.matches("()") // true 0019 public static let IgnoreMetacharacters
Options.swift:47
    if contains(.IgnoreMetacharacters) { options.insert(.IgnoreMetacharacters) }
= Options(rawValue: 1 << 1) 0020 0021 /// By default, "^" matches the beginning of the string and "$" matches the 0022 /// end of the string, ignoring any newlines. With this option, "^" will 0023 /// the beginning of each line, and "$" will match the end of each line. 0024 /// 0025 /// let foo = Regex("^foo", options: .AnchorsMatchLines) 0026 /// foo.allMatches("foo\nbar\nfoo\n").count // 2 0027 public static let AnchorsMatchLines
Options.swift:48
    if contains(.AnchorsMatchLines) { options.insert(.AnchorsMatchLines) }
= Options(rawValue: 1 << 2) 0028 0029 // MARK: OptionSetType 0030 0031 public let rawValue
Options.swift:34
    self.rawValue = rawValue
: Int 0032 0033 public init
Options.swift:10
  public static let IgnoreCase = Options(rawValue: 1)
Options.swift:19
  public static let IgnoreMetacharacters = Options(rawValue: 1 << 1)
Options.swift:27
  public static let AnchorsMatchLines = Options(rawValue: 1 << 2)
(rawValue: Int) { 0034 self.rawValue = rawValue 0035 } 0036 0037 } 0038 0039 internal extension Options { 0040 0041 /// Transform an instance of `Regex.Options` into the equivalent `NSRegularExpressionOptions`. 0042 /// 0043 /// - returns: The equivalent `NSRegularExpressionOptions`. 0044 func toNSRegularExpressionOptions
Regex.swift:21
      options: options.toNSRegularExpressionOptions())
Regex.swift:41
        options: options.toNSRegularExpressionOptions())
() -> NSRegularExpressionOptions { 0045 var options = NSRegularExpressionOptions() 0046 if contains(.IgnoreCase) { options.insert(.CaseInsensitive) } 0047 if contains(.IgnoreMetacharacters) { options.insert(.IgnoreMetacharacters) } 0048 if contains(.AnchorsMatchLines) { options.insert(.AnchorsMatchLines) } 0049 return options 0050 } 0051 0052 } 0053 0054 import Foundation 0055