                     }
                 }
             }
-            regexStr.appendContentsOf("?(?:/)?$")
+            regexStr.appendContentsOf("(?:/(?=$))?$")
 
             var regex: NSRegularExpression? = nil
             do {

                            if  matchExpRange.location != NSNotFound  &&  matchExpRange.location != -1  {
                                matchExp = path.bridge().substringWithRange(matchExpRange)
                            }
                            else  {
                                matchExp = "[^/]+?"
                            }
                            //plusQuestStar = path.bridge().substringWithRange(nonKeyMatch.rangeAtIndex(3))
                            keys.append(String(nonKeyIndex))
                            nonKeyIndex+=1
                            matched = true

                // If there was a leading slash, there will be an empty component in the split
                if  path.characters.count > 0  {
                    var matched = false
                    var prefix = ""
                    var matchExp = "[^/]+?"
                    var plusQuestStar = ""

                    if  path == "*"  {
                        // Handle a path element of * specially
