Fix invalid regular expressions in removePaths function.