                 regexStr.append("/\(path)")
             }
 
-            return (regexStr, keys, nonKeyIndex, true)
+            return (regexStr, keys, nonKeyIndex)
     }
 }

        }
        
        for path in paths {
            var status = false
            (regexStr, keys, nonKeyIndex, status) =
                handlePath(path, regexStr: regexStr, keys: keys, nonKeyIndex: nonKeyIndex)
            if !status {
                return (nil, nil)
            }
        }

        regexStr.append("(?:/(?=$))?")

                matched = true
            } else {
                let range = NSMakeRange(0, path.characters.count)

                if let keyMatch = keyRegex.firstMatch(in: path, options: [], range: range) {
                    // We found a path element with a named/key capture
                    let prefixRange = keyMatch.range(at: 1)
