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

        }
    }
    
    private var hasBalancedParentheses: Bool {
        
        let array = self.characters.map { String($0) }
        var leftCount = 0

        
        // 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
