         }
     }
     
-    private var hasBalancedParentheses: Bool {
+    private func hasBalancedParentheses(left: String, right: String) -> Bool {
         
         let array = self.characters.map { String($0) }
         var leftCount = 0

        
        for (index, letter) in array.enumerated() {
            
            if letter == "(" && (index == 0 || (index>0 && array[index-1] != "\\")) {
                leftCount += 1
            }
            
            if letter == ")" && (index == 0 || (index>0 && array[index-1] != "\\")) {
                rightCount += 1
            }
        }

        
        // crash occurs on Linux
        // when RegularExpression has not balanced parantheses
        guard regex.hasBalancedParentheses(left: "(", right: ")"),
            regex.hasBalancedParentheses(left: "[", right: "]") else {
                return []
        }
        
        // or when throws an exception
