 
 class RegularExpressions {
         
-    var regularExpresions = [String : NSRegularExpression]()
-
+    var _regularExpresions = [String : NSRegularExpression]()
+    
+    var regularExpresions: [String : NSRegularExpression] {
+        var regularExpresionsCopy: [String : NSRegularExpression]!
+        concurrentRegexQueue.sync {
+            regularExpresionsCopy = self._regularExpresions
+        }
+        return regularExpresionsCopy
+    }
+    private let concurrentRegexQueue = DispatchQueue(label: "com.phonenumberkit.regexqueue", qos: .default, attributes: .concurrent)
+
+    func addRegularExpression(regex: NSRegularExpression, pattern: String) {
+        concurrentRegexQueue.async(flags: .barrier) {
+            self._regularExpresions[pattern] = regex
+        }
+    }
+    
     var phoneDataDetector: NSDataDetector? = {
         do {
             let dataDetector = try NSDataDetector(types: NSTextCheckingResult.CheckingType.phoneNumber.rawValue)

    }()
    
    deinit {
        regularExpresions.removeAll()
        phoneDataDetector = nil
    }


            do {
                let currentPattern: NSRegularExpression
                currentPattern =  try NSRegularExpression(pattern: pattern, options:NSRegularExpression.Options.caseInsensitive)
                self.addRegularExpression(regex: currentPattern, pattern: pattern)
                return currentPattern
            }
            catch {
