      - throws: An error if failed.
      */
     public init(pattern: String, options: Options = []) throws {
-        let re = try NSRegularExpression(pattern: pattern, options: options)
+        let re = try NSRegularExpression(pattern: pattern, options: options.toNSRegularExpresstionOptions())
         self.regularExpression = re
+        self._options = options
 //        self.namedCaptureGroupInfo = extractNamedCaptureGroups(in: pattern, expectedGroupsCount: re.numberOfCaptureGroups)
         self.namedCaptureGroupInfo = [:]
     }

public struct Regex {
    
    /// Options of Regex.
    public typealias Options = NSRegularExpression.Options
    
    /// Wrapped NSRegularExpression.
    public var regularExpression: NSRegularExpression
    
    
    
    /**
     Creates a `Regex` with unchecked string literal and options. Runtime error is raised if the unchecked pattern is invalid.

    
    public init(regularExpression: NSRegularExpression) {
        self.regularExpression = regularExpression
        self._options = Options(regularExpression.options)
        self.namedCaptureGroupInfo = [:]
    }
    
